Request a booth only when cfp is open

This commit is contained in:
nasia 2017-08-16 11:42:57 +03:00 committed by Stella Rouzi
parent 8b5ebb3dd7
commit 703813248d
3 changed files with 13 additions and 1 deletions

View file

@ -75,7 +75,9 @@ class Ability
can [:new, :create], Payment, user_id: user.id
can [:index, :show], PhysicalTicket, user: user
can [:new, :create], Booth
can [:new, :create], Booth do |booth|
booth.new_record? && booth.conference.program.cfps.for_booths.try(:open?)
end
can [:edit, :update, :index, :show], Booth do |booth|
booth.users.include?(user)