| Class | ActiveRecord::Extensions::Like |
| In: |
ar-extensions/lib/ar-extensions/extensions.rb
|
| Parent: | Object |
ActiveRecord::Extension to translate Hash keys which end in _like or _contains with the approriate LIKE keyword used in SQL.
# the below two examples are equivalent
Model.find :all, :conditions=>{ :name_like => 'John' }
Model.find :all, :conditions=>{ :name_contains => 'John' }
Model.find :all, :conditions=>{ :name_starts_with => 'J' }
Model.find :all, :conditions=>{ :name_ends_with => 'n' }
| LIKE_RGX | = | /(.+)_(like|contains)$/ |
| STARTS_WITH_RGX | = | /(.+)_starts_with$/ |
| ENDS_WITH_RGX | = | /(.+)_ends_with$/ |