2014-08-28 15:21:05 +02:00
|
|
|
class EventsRegistration < ActiveRecord::Base
|
|
|
|
|
belongs_to :registration
|
|
|
|
|
belongs_to :event
|
2016-04-22 18:18:46 +03:00
|
|
|
|
|
|
|
|
has_one :user, through: :registration
|
|
|
|
|
|
2016-05-24 23:54:46 +05:30
|
|
|
has_paper_trail meta: { conference_id: :conference_id }
|
|
|
|
|
|
2016-04-22 18:18:46 +03:00
|
|
|
delegate :name, to: :registration
|
|
|
|
|
delegate :email, to: :registration
|
|
|
|
|
|
|
|
|
|
validates :event, :registration, presence: true
|
|
|
|
|
validates :event, uniqueness: { scope: :registration }
|
2016-05-24 23:54:46 +05:30
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def conference_id
|
|
|
|
|
registration.conference_id
|
|
|
|
|
end
|
2014-08-28 15:21:05 +02:00
|
|
|
end
|