automatically create free ticket with new conf

This commit is contained in:
Rishabh Saxena 2016-08-27 20:38:31 +05:30
parent a6f7516eae
commit 53291e25b5
No known key found for this signature in database
GPG key ID: FA3BDC38A9CB6807
2 changed files with 20 additions and 0 deletions

View file

@ -64,6 +64,8 @@ class Conference < ActiveRecord::Base
before_create :add_color
before_create :create_email_settings
after_create :create_free_ticket
def date_range_string
startstr = 'Unknown - '
endstr = 'Unknown'
@ -647,6 +649,14 @@ class Conference < ActiveRecord::Base
create_roles
end
##
# Creates free ticket for the conference
# after the conference has been successfully created
# Will create 1 new record for 'free' ticket
def create_free_ticket
ticket = Ticket.where(conference: self, title: 'Free Access', price_cents: 0).first_or_create!(description: 'Get free access tickets for the conference.')
end
##
# Creates the roles of the conference
# after the conference has been successfully created