added associations between cards and pages models

This commit is contained in:
Manu
2019-01-12 19:45:37 -05:00
parent 2dd953bdfd
commit 5627d2cf23
2 changed files with 2 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
class SiteCustomization::Page < ActiveRecord::Base class SiteCustomization::Page < ActiveRecord::Base
VALID_STATUSES = %w(draft published) VALID_STATUSES = %w(draft published)
has_many :cards, class_name: 'Widget::Card', foreign_key: 'site_customization_page_id'
translates :title, touch: true translates :title, touch: true
translates :subtitle, touch: true translates :subtitle, touch: true

View File

@@ -1,5 +1,6 @@
class Widget::Card < ActiveRecord::Base class Widget::Card < ActiveRecord::Base
include Imageable include Imageable
belongs_to :page, class_name: 'SiteCustomization::Page', foreign_key: 'site_customization_page_id'
# table_name must be set before calls to 'translates' # table_name must be set before calls to 'translates'
self.table_name = "widget_cards" self.table_name = "widget_cards"