Interesting things
People seem to think it would be useful to chain associations in the same way that named scopes work. E.g., post.comments.authors. We might look at providing a patch to do so.
Rspec and Rails 2.2 modifies rails to not rescue exceptions as it normally does. To fix that, add the following to your tests:
describe ThingsController do
before(:each) do
controller.use_rails_error_handling!
end
end
- A project was running into a problem on non dev/test environments with rails 2.2 where if we did a db:drop and a subsequent db:create, the migrations were blowing up with an exception on the Rails::Initializer.run line in environment.rb. The models were being loaded before any of the migrations had run, thus failing because the tables didn’t exist. To work around this, add config.eager_load_paths = [] in your Rails::Initializer. It was suggested this was either a bug in 2.2.2 and/or a bad interaction with desert.
Do you know how to set same controller behaviour in Merb? ;]
February 11, 2009 at 7:46 pm
Regarding the association chaining, it’s not tough to roll manually: http://gist.github.com/63041.
With that being said, it’s probably a bad idea, since it’s *way* too easy to abuse (speaking as someone who has done [such things](http://pivotallabs.com/users/nick/blog/articles/283–strike-ten-things-i-hate-about-proxy-objects-strike-part-i)).
A better idea might be identifying a missing join model, or even just de-normalization for de-normalization’s sake. Then again, it is a cool trick.
February 13, 2009 at 4:14 am