2.1

Rails 2.1 Bugs: Partial Updates Failure

My first web application upgraded to Rails 2.1 completely broke due to partial updates. For some reason, which I’m certainly willing to consider is some plugin or custom code, none of my changed objects ever reported that they were changed. And thus everytime an object was saved no new information was actually placed into the database. I’ve fixed the application by disabling partial updates with “ActiveRecord::Base.partial_updates = false” in environment.rb. Maybe in the future I’ll look into this issue further. Or perhaps I’ll wait for someone else to find it, resolve it, and simply copy the fix. It’s not a feature I need though it would be nice to have.

Update: It seems as though the problem was due to the flextimes plugin. I documented my discovery, changes, and lessons learned in Lessons for Rails: Pay attention to plugins and test everything.

Rails 2.1 Features: Change in find :include behavior

Interesting enough someone had mentioned this change to me over breakfast today but it was the first I had heard of it. That’s unfortunate because it was a change that ended up breaking my code. The jist of it is that when using an include parameter for finds Rails no longer just creates a join query. I agree that this is advantageous is many situations that are common for Rails apps but it neglects when you actually want to have a condition for the joined table. Thankfully it’s not too difficult to get the original behavior back by simply qualifying the column with its table name. I found some helpful details from these posts:

Update: The pluralization is tricky on these. The include must be the name of the association which is plural for has_many and singular for belongs_to. However the qualification must be the table name which is plural. Here is an example.

Rails 2.1 Migration Bugs: BenchmarkForRails

Upon updating an application to Rails 2.1 the first bug I saw prevented the application from loading due to the BenchmarkForRails plugin. Here's how I fixed it.

Syndicate content
Creative Commons License Except where otherwise noted, content on this site is licensed under a Creative Commons by-nc-sa 3.0 License