class CIA::Event

Public Class Methods

previous() click to toggle source
# File lib/cia/event.rb, line 12
def self.previous
  order("created_at desc")
end

Public Instance Methods

add_attribute_changes(changes) click to toggle source

tested via transaction_test.rb

# File lib/cia/event.rb, line 23
def add_attribute_changes(changes)
  changes.each do |attribute_name, (old_value, new_value)|
    attribute_changes.build(
      event: self,
      attribute_name: attribute_name,
      old_value: old_value,
      new_value: new_value,
      source: source
    )
  end
end
attribute_change_hash() click to toggle source
# File lib/cia/event.rb, line 16
def attribute_change_hash
  attribute_changes.inject({}) do |h, a|
    h[a.attribute_name] = [a.old_value, a.new_value]; h
  end
end
source_must_be_present?() click to toggle source
# File lib/cia/event.rb, line 35
def source_must_be_present?
  new_record? and action != "destroy" and (!attributes.key?("source_display_name") or source_display_name.blank?)
end