Class: Card::Change

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
mod/01_history/lib/card/change.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.delete_actionlessObject



14
15
16
17
18
19
# File 'mod/01_history/lib/card/change.rb', line 14

def self.delete_actionless
  Card::Change.where(
    "card_action_id NOT IN (?)",
    Card::Action.pluck("id"),
  ).delete_all
end

.find_by_field_name(value) ⇒ Object



26
27
28
29
# File 'mod/01_history/lib/card/change.rb', line 26

def self.find_by_field_name(value)
  index = value.is_a?(Integer) ? value : Card::TRACKED_FIELDS.index(value.to_s)
  find_by_field(index)
end

Instance Method Details

#fieldObject



10
11
12
# File 'mod/01_history/lib/card/change.rb', line 10

def field
  Card::TRACKED_FIELDS[read_attribute(:field)]
end

#field=(value) ⇒ Object



6
7
8
# File 'mod/01_history/lib/card/change.rb', line 6

def field=(value)
  write_attribute(:field, Card::TRACKED_FIELDS.index(value.to_s))
end

#find_by_field_name(value) ⇒ Object



21
22
23
24
# File 'mod/01_history/lib/card/change.rb', line 21

def find_by_field_name(value)
  index = value.is_a?(Integer) ? value : Card::TRACKED_FIELDS.index(value.to_s)
  find_by_field(index)
end