lib/purgatory/purgatory.rb in purgatory-2.7.0 vs lib/purgatory/purgatory.rb in purgatory-2.8.0
- old
+ new
@@ -8,10 +8,11 @@
before_create :destroy_pending_with_same_soul
validates :soul_type, presence: true
serialize :requested_changes
+ serialize :attr_accessor_fields
def self.pending
where(approved_at: nil)
end
@@ -36,9 +37,10 @@
end
def approve!(approver = nil)
return false if approved?
requested_changes.each{|k,v| soul.send(:write_attribute, k, v[1])}
+ attr_accessor_fields.each{|k,v| soul.instance_variable_set(k, v)}
if soul.save
self.approver = approver
self.approved_at = Time.now
save
return true