Showing posts with label rails. Show all posts
Showing posts with label rails. Show all posts

Sunday, December 12, 2010

no such file to load -- spec

While trying to use Goto Alternate File (⌃⇧↓) in TextMate's Cucumber Bundle I was seeing an error like this:
no such file to load -- spec

that was pointing to line 20 of:
~/Library/Application\ Support/TextMate/Bundles/Cucumber.tmbundle/Support/lib/cucumber/mate.rb

That line reads like this:

I changed it to:

Reloaded bundles (Bundles→Bundle Editor→Reload Bundles). And now things are working fine. My guess is RSpec 2 now goes by 'rspec' instead of 'spec'.

Friday, September 24, 2010

Rails 3 Complex Join Query

I just struggled mightily to have the new Rails 3 query stuff create the SQL I wanted. I figured it out eventually. Here's the story.

I have the following models:I wanted to add a method to Person that would return all the add-ons to which a person subscribed through payment plans:So, I knew I would need this SQL query:I tried things like this, cursing the new query stuff the whole while:They all failed. Finally, I got what I wanted:It turned out to be nice and simple and I can do sweet chaining things like this:Now, I love the new Rails 3 query stuff.

Monday, August 2, 2010

NoMethodError: undefined method sanitize_for_mass_assignment

once upon a time i started getting a strange error:

NoMethodError: undefined method `sanitize_for_mass_assignment'


after poking and prodding it turned out that after running bundle install, bundler grabbed the latest version of the state_machine gem, namely 0.9.4, which makes the call to sanitize_for_mass_assignment, which wasn't found. i likely have some other dependencies missing. however, to get back to my regularly scheduled coding, i just modified my Gemfile to use a previous version of state_machine:

gem 'state_machine', '0.9.3'


now all is good and my rake tests are passing again.