Sha256: cfd3061528d6b304f881cf5078729d940c62e8744a94f51385198199cc80e29b

Contents?: true

Size: 428 Bytes

Versions: 4

Compression:

Stored size: 428 Bytes

Contents

module Socialization
  module LikeStore
    def self.included(base)
      base.class_eval do
        belongs_to :liker,    :polymorphic => true
        belongs_to :likeable, :polymorphic => true

        validates_uniqueness_of :likeable_type, :scope => [:likeable_id, :liker_type, :liker_id], :message => 'You cannot like the same thing twice.'

        def self.human_attribute_name(*args); ''; end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
socialization-0.2.2 lib/socialization/like_store.rb
socialization-0.2.1 lib/socialization/like_store.rb
socialization-0.2.0 lib/socialization/like_store.rb
socialization-0.1.0 lib/socialization/like_store.rb