Update synapse.rb

This commit is contained in:
Connor Turland 2017-01-27 23:33:50 -05:00 committed by GitHub
parent 479ccc9fd3
commit 3f75e436ba

View file

@ -22,6 +22,7 @@ class Synapse < ApplicationRecord
where(topic1_id: topic_id).or(where(topic2_id: topic_id))
}
before_create :set_perm_by_defer
after_update :after_updated
delegate :name, to: :user, prefix: true
@ -62,6 +63,12 @@ class Synapse < ApplicationRecord
output += %(\n)
output
end
protected
def set_perm_by_defer
permission = defer_to_map.permission if defer_to_map
end
def after_updated
attrs = %w(desc category permission defer_to_map_id)