Make widget cards polymorphic

So now we'll be able to add them to other sections.

We're also adding a `dependent: :destroy` relation to models having
cards since it doesn't make sense to have cards around when their page
has been destroyed.
This commit is contained in:
Javi Martín
2021-01-07 18:48:09 +01:00
parent c66a5a30ef
commit ee29ca43a5
10 changed files with 33 additions and 24 deletions

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_12_16_132642) do
ActiveRecord::Schema.define(version: 2021_01_06_132909) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -1647,9 +1647,10 @@ ActiveRecord::Schema.define(version: 2020_12_16_132642) do
t.boolean "header", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "site_customization_page_id"
t.integer "cardable_id"
t.integer "columns", default: 4
t.index ["site_customization_page_id"], name: "index_widget_cards_on_site_customization_page_id"
t.string "cardable_type", default: "SiteCustomization::Page"
t.index ["cardable_id"], name: "index_widget_cards_on_cardable_id"
end
create_table "widget_feeds", id: :serial, force: :cascade do |t|