Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Includes:
Deltas
Defined in:
lib/ar-deltas.rb

Defined Under Namespace

Classes: InvalidDeltaColumn

Class Method Summary collapse

Class Method Details

.delta_attributes(*args) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/ar-deltas.rb', line 38

def self.delta_attributes(*args)
  @_delta_attributes ||= Set.new
  
  return @_delta_attributes if args.empty?
  
  args.each do |attribute|
    raise InvalidDeltaColumn.new("Delta attributes only work with number attributes, column `#{attribute}` is not a number.") unless self.columns_hash[attribute.to_s].number?
    @_delta_attributes.add(attribute)
  end
end