Search code examples
ruby-on-railsruby-on-rails-pluginsruby-on-rails-2

What is the backport of Rails 3 style finders (.where) to Rails 2?


I know I've heard of a library that provides Rails 3 style finders (.where) to earlier versions of Rails, but web search is failing me.

I've got a 2.3 project that needs a new feature, and I'd rather use the newer style in case it gets upgraded.


Solution

  • Would something like the Fake_arel gem help?

    Fake_arel simulates and supports a variety of features from Rails 3 for earlier Rails versions. The only major requirement is that your currently-used ActiveRecord gem needs to be greater than or equal to version 2.3.5.

    The documentation also notes that Fake_arel can be used as a bridge between Rails 2 and Rails 3 apps, which could ease future transitions to later Rails versions.