This commit is contained in:
nasia-sam 2017-06-06 15:44:46 +00:00 committed by GitHub
commit 743342c40c
15 changed files with 254 additions and 2 deletions

7
app/models/booth.rb Normal file
View file

@ -0,0 +1,7 @@
class Booth < ActiveRecord::Base
belongs_to :conference
has_many :booth_requests
has_many :users, through: :booth_requests
validate :title, presence: true
end

View file

@ -0,0 +1,4 @@
class BoothRequest < ActiveRecord::Base
belongs_to :booth
belongs_to :user
end

View file

@ -22,6 +22,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 :lodgings, dependent: :destroy
has_many :registrations, dependent: :destroy

View file

@ -50,11 +50,13 @@ class User < ActiveRecord::Base
has_many :votes, dependent: :destroy
has_many :voted_events, through: :votes, source: :events
has_many :subscriptions, dependent: :destroy
has_many :booth_requests
has_many :booths, through: :users_booths
accepts_nested_attributes_for :roles
scope :admin, -> { where(is_admin: true) }
scope :active, -> { where(is_disabled: false) }
validates :email, presence: true
validates :username,