One user one registration ticket
A user cannot have more than one registration ticket per conference.
This commit is contained in:
parent
de1fa448a2
commit
27bf79996d
8 changed files with 104 additions and 21 deletions
|
|
@ -51,7 +51,11 @@ class User < ActiveRecord::Base
|
|||
has_many :events_registrations, through: :registrations
|
||||
has_many :ticket_purchases, dependent: :destroy
|
||||
has_many :payments, dependent: :destroy
|
||||
has_many :tickets, through: :ticket_purchases, source: :ticket
|
||||
has_many :tickets, through: :ticket_purchases, source: :ticket do
|
||||
def for_registration conference
|
||||
where(conference: conference, registration_ticket: true).first
|
||||
end
|
||||
end
|
||||
has_many :votes, dependent: :destroy
|
||||
has_many :voted_events, through: :votes, source: :events
|
||||
has_many :subscriptions, dependent: :destroy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue