Class: AuditedChangeSet::ChangeSet
- Inherits:
-
Object
- Object
- AuditedChangeSet::ChangeSet
- Includes:
- Enumerable
- Defined in:
- lib/audited_change_set/change_set.rb
Class Method Summary collapse
Instance Method Summary collapse
- #changed_fields ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(auditable, fields = nil, change_id = nil) ⇒ ChangeSet
constructor
A new instance of ChangeSet.
Constructor Details
#initialize(auditable, fields = nil, change_id = nil) ⇒ ChangeSet
Returns a new instance of ChangeSet.
9 10 11 12 13 |
# File 'lib/audited_change_set/change_set.rb', line 9 def initialize(auditable, fields=nil, change_id=nil) @auditable = auditable @fields = fields @change_id = change_id end |
Class Method Details
.for_auditable(klass, id, fields = nil, change_id = nil) ⇒ Object
5 6 7 |
# File 'lib/audited_change_set/change_set.rb', line 5 def self.for_auditable(klass, id, fields=nil, change_id=nil) new(klass.find(id), fields, change_id) end |
Instance Method Details
#changed_fields ⇒ Object
21 22 23 |
# File 'lib/audited_change_set/change_set.rb', line 21 def changed_fields Change.field_names_for_audits(@auditable.audits).sort end |
#each(&block) ⇒ Object
17 18 19 |
# File 'lib/audited_change_set/change_set.rb', line 17 def each(&block) changes.each(&block) end |