Refactoring Tickets

- Tickets now independent from registration
- Implemented money gem
#419
This commit is contained in:
Chrisbr 2014-08-28 15:21:05 +02:00
parent 5485fe0e7f
commit 5f8a8ac6d9
63 changed files with 1581 additions and 573 deletions

View file

@ -3,21 +3,21 @@ class Registration < ActiveRecord::Base
belongs_to :conference
belongs_to :dietary_choice
has_one :supporter_registration
has_one :supporter_level, through: :supporter_registration
has_and_belongs_to_many :social_events
has_and_belongs_to_many :events
has_and_belongs_to_many :qanswers
has_and_belongs_to_many :vchoices
has_many :events_registrations
has_many :workshops, through: :events_registrations, source: :event
attr_accessible :user_id, :conference_id, :attending_social_events, :attending_with_partner,
:using_affiliated_lodging, :arrival, :departure, :user_attributes, :attended,
:other_dietary_choice, :dietary_choice_id, :handicapped_access_required,
:supporter_registration_attributes, :social_event_ids, :other_special_needs,
:social_event_ids, :other_special_needs,
:event_ids, :volunteer, :vchoice_ids, :qanswer_ids, :qanswers_attributes
accepts_nested_attributes_for :user
accepts_nested_attributes_for :supporter_registration
accepts_nested_attributes_for :social_events
accepts_nested_attributes_for :qanswers
@ -30,7 +30,7 @@ class Registration < ActiveRecord::Base
validates_uniqueness_of :user_id, scope: :conference_id, message: 'already Registered!'
after_create :set_week
after_create :set_week, :subscribe_to_conference, :send_registration_mail
def week
created_at.strftime('%W').to_i
@ -38,6 +38,16 @@ class Registration < ActiveRecord::Base
private
def subscribe_to_conference
Subscription.create(conference_id: conference.id, user_id: user.id)
end
def send_registration_mail
if conference.email_settings.send_on_registration?
Mailbot.delay.registration_mail(conference, user)
end
end
def set_week
self.week = created_at.strftime('%W')
save!