My Profile Photo

rubycoloredglasses


I'm Jason, a web applications developer in the San Francisco Bay area.


  1. Duplicate associated records when using FactoryGirl

    When I decided to start using tests as part of my development practice, I had the choice of using the default fixture system, or using one of the recommended fixture alternatives, also known as factories. I decided upon using FactoryGirl given it’s popular mention on the web, and one of the projects at work was using it. …


  2. Finding Records without Specific Child in Many-to-Many Relationship

    Okay. Here is a tricky challenge. Let’s say you are coding a blog system where Posts may have many Tags, and a tag can have many posts. Your database would have a ‘posts’ table, a ‘tags’ table, and a ‘post_tags’. With Ruby on Rails this would be configured for an ActiveRecord model using the has_many through method. …


  3. Listing Gems from Rails Console

    Got this from Stack Overflow, figured it could come in handy at some point in the future. …


  4. Add a Serialized Hash Attribute to a Factory_Girl Definition

    I recently declared an ActiveRecord model which stores a serialized Hash inside of a text field. When I tried to setup a factory for this model using FactoryGirl, I received many syntax errors. This is because FactoryGirl attributes expect a single value or a certain form of code block. …


  5. List Sorted Methods in Ruby

    I often use ‘methods’ to get a list of methods available for an object in Ruby, but it can be a pain trying to look through the list for what I want. I wish it outputed in a sorted list straight down the page. This template will help you achieve that. Maybe I should override the ‘methods’ method. Hm… …


  6. Updating a Serialized Object from a Web form

    You may run into a situation where you create some sort of standard Ruby class that you want to associate with an ActiveRecord model. The serialize method allows you to store an object inside of a text field for an ActiveRecord object. …


  7. RSpec Controller Tests Receiving 'No route matches' Error

    I’m developing a Rails engine gem for the company I’m working for, which will provide an API for the applications we’re using. The gem I’m creating will be used with a Rails 3.0.9 system, using Rspec-Rails version 2.10.1. I had a route to my API interface setup in the config/routes.rb file like so: …


  8. Cubase Installation Failure

    I recently ran into issues installing Cubase 4 on my Mac running Snow Leopard. I uninstalled Cubase 5 Essential, thinking that this was causing a conflict, and thus stopping me from installing an older version. This wasn’t the case I tried to install Cubase 5 Essential again, and I got the same type of error with it’s installer. I received Cubase 6 in the mail today and tried to install it…only to receive the same type of error: …


  9. Generators Not Working in Rails 2.3.8

    I’m currently working on a gem that is going to use a generator to create files in a Rails 2.3.8 application. One of the applications we’re still using is using Rails 2.3.8, so I have to make a gem compatible with that version of Rails. …


  10. Establishing New Ruby Environment in a Folder using RVM

    I know this is documented on the official RVM website, but I hate having to look it up over and over again each time I want to create a new RVMRC file. …