module Socialization::Followable
Public Instance Methods
followed_by?(follower)
click to toggle source
Specifies if self is followed by a {Follower} object.
@return [Boolean]
# File lib/socialization/subjects/followable.rb, line 28 def followed_by?(follower) raise Socialization::ArgumentError, "#{follower} is not follower!" unless follower.respond_to?(:is_follower?) && follower.is_follower? Socialization.follow_model.follows?(follower, self) end
followers(klass, opts = {})
click to toggle source
Returns an array of {Follower}s following self.
@param [Class] klass the {Follower} class to be included. e.g. `User` @return [Array<Follower, Numeric>] An array of Follower
objects or IDs
# File lib/socialization/subjects/followable.rb, line 37 def followers(klass, opts = {}) Socialization.follow_model.followers(self, klass, opts) end
followers_relation(klass, opts = {})
click to toggle source
Returns a scope of the {Follower}s following self.
@param [Class] klass the {Follower} class to be included in the scope. e.g. `User` @return ActiveRecord::Relation
# File lib/socialization/subjects/followable.rb, line 45 def followers_relation(klass, opts = {}) Socialization.follow_model.followers_relation(self, klass, opts) end
is_followable?()
click to toggle source
Specifies if self can be followed.
@return [Boolean]
# File lib/socialization/subjects/followable.rb, line 20 def is_followable? true end
Also aliased as: followable?