Newer
Older
# == Schema Information
#
# Table name: likes
#
# id :integer not null, primary key
# likeable_id :integer
# likeable_type :string
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# *current_user* likes *likeable*
# *current_user* unlikes *likeable*
belongs_to :likeable, polymorphic: true, counter_cache: true
belongs_to :user
validates_presence_of :user, :likeable
validates :user_id, uniqueness: { scope: [:likeable_id, :likeable_type] }

Israel Barreto Sant'Anna
committed
def recipient
likeable
end