Sha256: b359c96a774bfe32d52e401e7240847ec05942005b1a09161df0e9f73ed20137
Contents?: true
Size: 590 Bytes
Versions: 1
Compression:
Stored size: 590 Bytes
Contents
module Mongoid module Followee extend ActiveSupport::Concern included do |base| base.has_many :followers, :class_name => 'Follow', :as => :follower, :dependent => :destroy end # see if this model is followed of some model # # Example: # >> @clyde.follower?(@bonnie) # => true def follower?(model) 0 < self.followers.find(:all, conditions: {ff_id: model.id}).limit(1).count end # view all selfs followers # # Example: # >> @clyde.follower?(@bonnie) # => true def followers(model) #TODO end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid_follow-0.0.2 | lib/mongoid_follow/followee.rb |