Add unregistered speakers scope to program

And use it in Conference#registration_limit_exceeded?

Also change self.registered(conference) to registered(conference) to fix failures in linters
This commit is contained in:
Christina Anagnostou 2017-12-16 16:30:11 +02:00 committed by Stella Rouzi
parent e5948698db
commit 979377f2df
2 changed files with 5 additions and 1 deletions

View file

@ -51,6 +51,10 @@ class Program < ApplicationRecord
def registered(conference)
joins(:registrations).where('registrations.conference_id = ?', conference.id)
end
def unregistered(conference)
self - registered(conference)
end
end
accepts_nested_attributes_for :event_types, allow_destroy: true