No commit activity in last 3 years
No release in over 3 years
Overrides dynamic finders in ActiveRecord module to use new Activerecord relation metho
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.3
>= 0
 Project Readme

OverrideActiveRecordDynamicFinders

Overrides find, find_by_, find_all_by_, find_last_by_* and count method for the ActiveRecord module to use the new ActiveRecord relation methods like where, limit, offset etc.

Installation

Add this line to your application's Gemfile:

gem 'override_activerecord_dynamic_finders'

And then execute:

$ bundle

Or install it yourself as:

$ gem install override_activerecord_dynamic_finders

Usage

when upgrading one of the applications from rails 2.3 to 3.2 the onemajor hurdel was to update the ActiveRecord query methods like find(:all, :conditions => "...", select => "..."), find_by_status("active", :conditions => "...") etc.

As we had more than 2000 such method calls, so it was not feasible for us to to change each and every query to use new ActiveRecord methods.

Then I decided to come-up with a library which lets you use these methods, but behind the secenes these methods use only new ActiveRecord relation methods like where, limit, offset, includes, having etc. Just include this gem in your gemfile and you are good to go.

It overrides following methods for the ActiveRecord model class

  1. find
  2. find_by_*
  3. find_(all|last)by*
  4. count

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request