[#345] temporaly add attribute accessible to relation
This commit is contained in:
parent
58c057b5c2
commit
6573bb0d9e
|
@ -9,6 +9,8 @@ class Relation < ActiveRecord::Base
|
|||
# validate { errors.add(:actor, :taken) if Relation.where(actor_type: self.actor_type, actor_id: self.actor_id).present? }
|
||||
before_validation :add_default_role
|
||||
|
||||
attr_accessible :actor_id, :actor_type, :target_id, :target_type, :role
|
||||
|
||||
scope :by_user_through_groups, ->(u) {
|
||||
where("actor_type = 'User' AND actor_id = ? OR actor_type = 'Group' AND actor_id IN (?)", u.id, u.group_ids)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue