Introducing delegation for city and country name (Conference - Venue

Using ActiveSupport delegate macro.
This commit is contained in:
Espartaco Palma 2020-01-23 21:20:10 -08:00 committed by Henne Vogelsang
parent f50a92bf53
commit fd2635509f
No known key found for this signature in database
GPG key ID: 9D6164C2955FADE0
2 changed files with 45 additions and 0 deletions

View file

@ -25,6 +25,9 @@ class Conference < ApplicationRecord
has_one :email_settings, dependent: :destroy
has_one :program, dependent: :destroy
has_one :venue, dependent: :destroy
delegate :city, :country_name, to: :venue, allow_nil: true
delegate :name, :street, to: :venue, prefix: true, allow_nil: true
has_many :physical_tickets, through: :ticket_purchases
has_many :ticket_purchases, dependent: :destroy
has_many :payments, dependent: :destroy