Introduce Call for Booths
This commit is contained in:
parent
66ac45efc8
commit
7ee9b2966a
13 changed files with 191 additions and 16 deletions
|
|
@ -3,7 +3,7 @@ class Booth < ActiveRecord::Base
|
|||
has_many :booth_requests
|
||||
has_many :users, through: :booth_requests
|
||||
|
||||
validate :title,
|
||||
validates :title,
|
||||
uniqueness: { case_sensitive: fasle},
|
||||
presence: true
|
||||
|
||||
|
|
|
|||
22
app/models/call_for_booth.rb
Normal file
22
app/models/call_for_booth.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class CallForBooth < ActiveRecord::Base
|
||||
belongs_to :conference
|
||||
|
||||
validates :start_date, :end_date, :booth_limit, presence: true
|
||||
validate :before_end_of_conference
|
||||
validate :start_date_before_end_date
|
||||
|
||||
private
|
||||
|
||||
def before_end_of_conference
|
||||
errors
|
||||
.add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date)
|
||||
|
||||
errors
|
||||
.add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date)
|
||||
end
|
||||
|
||||
def start_date_before_end_date
|
||||
errors
|
||||
.add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
|
||||
end
|
||||
end
|
||||
|
|
@ -16,6 +16,7 @@ class Conference < ActiveRecord::Base
|
|||
has_one :splashpage, dependent: :destroy
|
||||
has_one :contact, dependent: :destroy
|
||||
has_one :registration_period, dependent: :destroy
|
||||
has_one :call_for_booths, dependent: :destroy
|
||||
has_one :email_settings, dependent: :destroy
|
||||
has_one :program, dependent: :destroy
|
||||
has_one :venue, dependent: :destroy
|
||||
|
|
@ -24,7 +25,7 @@ class Conference < ActiveRecord::Base
|
|||
has_many :supporters, through: :ticket_purchases, source: :user
|
||||
has_many :tickets, dependent: :destroy
|
||||
has_many :resources, dependent: :destroy
|
||||
has_many :booths, dependent: :destroy
|
||||
has_many :booths, dependent: :destroy
|
||||
|
||||
has_many :lodgings, dependent: :destroy
|
||||
has_many :registrations, dependent: :destroy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue