Module: ActiveRecord::Acts::Comparable::ClassMethods

Defined in:
lib/acts_as_comparable/acts_as_comparable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_comparable(options = {}) ⇒ Object

Sets up the current model to be comparable against other models or instances.

Options

  • :only - an array of fields as symbols which should be held onto for comparison

  • :except - an array of fields as symbols which should not be held onto for comparison

  • :attrs_map - a hash of field to field mappings as symbols which define how fields should be compared



54
55
56
57
58
59
60
61
# File 'lib/acts_as_comparable/acts_as_comparable.rb', line 54

def acts_as_comparable( options = {} )
  #pullin in necessary methods
  cattr_accessor :comparable_options
  include ActiveRecord::Acts::Comparable::InstanceMethods
  
  #setup options
  self.comparable_options = options
end