Sha256: b7ff488b685b8a97ff10dfe981c6471a46a541bb700023c7cb71f9cc901cdce4

Contents?: true

Size: 482 Bytes

Versions: 2

Compression:

Stored size: 482 Bytes

Contents

module Recommendable
  class Like < ActiveRecord::Base
    self.table_name = 'recommendable_likes'
    attr_accessible :user_id, :likeable_id, :likeable_type

    belongs_to :user, :class_name => Recommendable.user_class.to_s, :foreign_key => :user_id
    belongs_to :likeable, :polymorphic => true
    
    validates :user_id, :uniqueness => { :scope => [:likeable_id, :likeable_type],
                                         :message => "has already liked this item" }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
recommendable-0.1.8 app/models/recommendable/like.rb
recommendable-0.1.6 app/models/recommendable/like.rb