Class ActiveRecord::Extensions::Comparison
In: ar-extensions/lib/ar-extensions/extensions.rb
Parent: Object

ActiveRecord::Extension to translate Hash keys which end in _lt, _lte, _gt, or _gte with the approriate <, <=, >, or >= symbols.

  • _lt - denotes less than
  • _gt - denotes greater than
  • _lte - denotes less than or equal to
  • _gte - denotes greater than or equal to

Examples

 Model.find :all, :conditions=>{ 'number_gt'=>100 }
 Model.find :all, :conditions=>{ 'number_lt'=>100 }
 Model.find :all, :conditions=>{ 'number_gte'=>100 }
 Model.find :all, :conditions=>{ 'number_lte'=>100 }

Methods

Constants

SUFFIX_MAP = { 'eq'=>'=', 'lt'=>'<', 'lte'=>'<=', 'gt'=>'>', 'gte'=>'>=', 'ne'=>'!=', 'not'=>'!=' }
ACCEPTABLE_COMPARISONS = [ String, Numeric, Time, DateTime ]

Public Class methods

[Validate]