Introduce an association between User and Event
Introduce an association between User and Event for the user schedule. As there was already a relation call users in Event the new relation is called public_users. And for the same reason the relation in Event is called public_events.
This commit is contained in:
parent
6e276b2787
commit
39e05a29fa
4 changed files with 18 additions and 0 deletions
|
|
@ -34,9 +34,12 @@ class Event < ApplicationRecord
|
|||
belongs_to :difficulty_level
|
||||
belongs_to :program
|
||||
|
||||
has_and_belongs_to_many :favourite_users, class_name: 'User'
|
||||
|
||||
accepts_nested_attributes_for :event_users, allow_destroy: true
|
||||
accepts_nested_attributes_for :speakers, allow_destroy: true
|
||||
accepts_nested_attributes_for :users
|
||||
accepts_nested_attributes_for :favourite_users
|
||||
|
||||
before_create :generate_guid
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ class User < ApplicationRecord
|
|||
has_many :booths, through: :booth_requests
|
||||
has_many :survey_replies
|
||||
has_many :survey_submissions
|
||||
has_and_belongs_to_many :favourite_events, class_name: 'Event'
|
||||
|
||||
accepts_nested_attributes_for :roles
|
||||
|
||||
scope :admin, -> { where(is_admin: true) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue