Sha256: 3e527fe1a07be935a2e7c9d7131a73b0d3d2b694e6f844d14b6cce8c29b18b7d

Contents?: true

Size: 446 Bytes

Versions: 4

Compression:

Stored size: 446 Bytes

Contents

module Socialization
  module FollowStore
    def self.included(base)
      base.class_eval do
        belongs_to :follower,   :polymorphic => true
        belongs_to :followable, :polymorphic => true

        validates_uniqueness_of :followable_type, :scope => [:followable_id, :follower_type, :follower_id], :message => 'You cannot follow 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/follow_store.rb
socialization-0.2.1 lib/socialization/follow_store.rb
socialization-0.2.0 lib/socialization/follow_store.rb
socialization-0.1.0 lib/socialization/follow_store.rb