
We recently upgraded a several-year old Rails application up to the Rails 4 release candidate. One of the most painful aspects of the upgrade was dealing with the virtual avalanche of deprecation warnings coming from all the old ActiveRecord queries that were doing something like:
Post.find(:all, :conditions => {:id => post_id})
Of course applications written since Rails 3 would use the new Arel-based approach, which would look more like this:
Post.where(id: post_id)
Manually changing many dozens of ActiveRecord statements to remove deprecation warnings could be error prone and tedious. So I thought it would be fun to write a tool that would do the conversion for you. You could then just paste the converted statement into your code, reasonably sure that it will still work.
Enter the Wherelizer: http://wherelizer.agileleague.com/
Caveat: Please be sure to test any code that the Wherelizer produces, as this is still a beta tool!
The query conversion part of Wherelizer is also packaged as a gem and available on github.