Sha256: 106d49d170cf8bab7d98634560ac376bda2527a43554dde9a177af1b471e97f6

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

class Follow < ActiveRecord::Base
  belongs_to :followable, :polymorphic => true
  belongs_to :follower, :polymorphic => true

  scope :for_follower_type, lambda { |follower_type| where("follower_type = ?", follower_type) }
  scope :for_followable_type, lambda { |followable_type| where("followable_type = ?", followable_type) }
  scope :for_follower, lambda { |follower| where(["follower_id = ?", follower.id]).for_follower_type(ActsAsFollowable::Lib.class_name(follower)) }
  scope :for_followable, lambda { |followable| where(["followable_id = ?", followable.id]).for_followable_type(ActsAsFollowable::Lib.class_name(followable)) }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_followable-0.1.9 app/models/follow.rb