include an indicator of which values changed
This commit is contained in:
parent
839ff66bcf
commit
223d31c4f4
2 changed files with 2 additions and 0 deletions
|
@ -48,6 +48,7 @@ class Synapse < ApplicationRecord
|
||||||
new = self.attributes.select {|k,v| attrs.include?(k) }
|
new = self.attributes.select {|k,v| attrs.include?(k) }
|
||||||
old = changed_attributes.select {|k,v| attrs.include?(k) }
|
old = changed_attributes.select {|k,v| attrs.include?(k) }
|
||||||
meta = new.merge(old) # we are prioritizing the old values, keeping them
|
meta = new.merge(old) # we are prioritizing the old values, keeping them
|
||||||
|
meta['changed'] = changed_attributes.keys.select {|k| attrs.include?(k) }
|
||||||
Events::SynapseUpdated.publish!(self, user, meta)
|
Events::SynapseUpdated.publish!(self, user, meta)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -143,6 +143,7 @@ class Topic < ApplicationRecord
|
||||||
new = self.attributes.select {|k,v| attrs.include?(k) }
|
new = self.attributes.select {|k,v| attrs.include?(k) }
|
||||||
old = changed_attributes.select {|k,v| attrs.include?(k) }
|
old = changed_attributes.select {|k,v| attrs.include?(k) }
|
||||||
meta = new.merge(old) # we are prioritizing the old values, keeping them
|
meta = new.merge(old) # we are prioritizing the old values, keeping them
|
||||||
|
meta['changed'] = changed_attributes.keys.select {|k| attrs.include?(k) }
|
||||||
Events::TopicUpdated.publish!(self, user, meta)
|
Events::TopicUpdated.publish!(self, user, meta)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue