DelegatedType
code:ruby
class Entry < ApplicationRecord
belongs_to :account
belongs_to :creator
end
module Entryable
extend ActiveSupport::Concern
included do
has_one :entry, as: :entryable, touch: true
end
end
class Message < ApplicationRecord
include Entryable
end
class Comment < ApplicationRecord
include Entryable
end