class Pravangi::PendingApproval
Public Instance Methods
approve_changes()
click to toggle source
# File lib/pravangi/models/pending_approval.rb, line 20 def approve_changes PendingApproval.transaction do resource.skip_approval = true object_changes.each do |k,v| resource[k] = v[1] end self.update_attribute(:is_approved, true) resource.save resource.reload end end
as_object()
click to toggle source
# File lib/pravangi/models/pending_approval.rb, line 12 def as_object @object ||= YAML.load(raw_object) end
changed_object_attributes()
click to toggle source
# File lib/pravangi/models/pending_approval.rb, line 16 def changed_object_attributes self.object_changes.keys end
reject_changes()
click to toggle source
# File lib/pravangi/models/pending_approval.rb, line 32 def reject_changes self.update_attribute(:is_rejected, true) end
skip_attributes()
click to toggle source
# File lib/pravangi/models/pending_approval.rb, line 36 def skip_attributes if self.resource.class.pravangi_options[:skip_attributes] object_changes.except(*self.resource.class.pravangi_options[:skip_attributes]) end end