Add contactable to tracks

Added social media fields to track submission form
by using a polymorphic association with the
Contact Model.
This commit is contained in:
Rishabh Singh 2019-06-13 23:45:05 +05:30
parent 770a63e15c
commit 465976bc60
7 changed files with 31 additions and 3 deletions

View file

@ -4,6 +4,7 @@ class Contact < ApplicationRecord
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }
belongs_to :conference
belongs_to :contactable, polymorphic: true
validates :conference, presence: true
# Conferences only have one contact

View file

@ -12,6 +12,8 @@ class Track < ApplicationRecord
belongs_to :selected_schedule, class_name: 'Schedule'
has_many :events, dependent: :nullify
has_many :schedules
has_one :contact, as: :contactable
accepts_nested_attributes_for :contact
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }