8aa99e34b4
Instead of delegating. With a polymorphic relationship, relying on a certain attribute implies doing things like aliasing "mentioner" to "creator" or similar.
8 lines
214 B
Ruby
8 lines
214 B
Ruby
class Mention < ApplicationRecord
|
|
include Notifiable
|
|
|
|
belongs_to :container, polymorphic: true
|
|
belongs_to :mentioner, class_name: "User"
|
|
belongs_to :mentionee, class_name: "User", inverse_of: :mentions
|
|
end
|