diff --git a/app/models/site_customization/page.rb b/app/models/site_customization/page.rb index 9940e66d9..9d3c6b37e 100644 --- a/app/models/site_customization/page.rb +++ b/app/models/site_customization/page.rb @@ -1,5 +1,6 @@ class SiteCustomization::Page < ActiveRecord::Base VALID_STATUSES = %w(draft published) + has_many :cards, class_name: 'Widget::Card', foreign_key: 'site_customization_page_id' translates :title, touch: true translates :subtitle, touch: true diff --git a/app/models/widget/card.rb b/app/models/widget/card.rb index 69023b0ce..0ef8f591f 100644 --- a/app/models/widget/card.rb +++ b/app/models/widget/card.rb @@ -1,5 +1,6 @@ class Widget::Card < ActiveRecord::Base include Imageable + belongs_to :page, class_name: 'SiteCustomization::Page', foreign_key: 'site_customization_page_id' # table_name must be set before calls to 'translates' self.table_name = "widget_cards"