Add authorization for toggle_favorite and rename route

This commit is contained in:
Stella Rouzi 2018-09-20 00:45:50 +03:00 committed by Henne Vogelsang
parent 2485923319
commit 91629d9b92
5 changed files with 11 additions and 5 deletions

View file

@ -108,6 +108,10 @@ class Ability
event.users.include?(user)
end
can :toggle_favorite, Event do |event|
event.scheduled?
end
# can manage the commercials of their own events
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)