Files
nairobi/app/models/concerns/cardable.rb
Javi Martín ee29ca43a5 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.
2021-01-14 17:37:58 +01:00

8 lines
157 B
Ruby

module Cardable
extend ActiveSupport::Concern
included do
has_many :cards, class_name: "Widget::Card", as: :cardable, dependent: :destroy
end
end