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.

Examples

 # 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' }

Methods

process  

Constants

LIKE_RGX = /(.+)_(like|contains)$/
STARTS_WITH_RGX = /(.+)_starts_with$/
ENDS_WITH_RGX = /(.+)_ends_with$/

Public Class methods

[Validate]