Refactor code
This commit is contained in:
parent
59076c9dd7
commit
067f61364d
1 changed files with 8 additions and 2 deletions
|
|
@ -52,7 +52,7 @@ class Ability
|
|||
|
||||
can [:new, :create], Registration do |registration|
|
||||
conference = registration.conference
|
||||
conference.registration_open? && registration.new_record? && !conference.registration_limit_exceeded?
|
||||
can_register?(conference)
|
||||
end
|
||||
|
||||
can :show, Event do |event|
|
||||
|
|
@ -66,7 +66,7 @@ class Ability
|
|||
else
|
||||
can [:new, :create], Registration do |registration|
|
||||
conference = registration.conference
|
||||
conference.registration_open? && registration.new_record? && !conference.registration_limit_exceeded?
|
||||
can_register?(conference)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -243,3 +243,9 @@ class Ability
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def can_register? conference
|
||||
conference.registration_open? &&
|
||||
registration.new_record? &&
|
||||
!conference.registration_limit_exceeded?
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue