module ActsAsStarable::Starable::InstanceMethods
Public Instance Methods
all_starers(options={})
click to toggle source
Returns the actual records which have starred this instance.
# File lib/acts_as_starable/starable.rb, line 50 def all_starers(options={}) all_starings(options).collect { |f| f.starer } end
all_starings(options={})
click to toggle source
Returns the star records related to this instance with the starer included.
# File lib/acts_as_starable/starable.rb, line 45 def all_starings(options={}) apply_options_to_scope(starings_scoped, options) end
get_star_for(starer)
click to toggle source
Returns a star record for the current instance and starer object.
# File lib/acts_as_starable/starable.rb, line 55 def get_star_for(starer) self.starings.for_starer(starer).first end
starers_by_type(starer_type, options={})
click to toggle source
Returns the actual records of a particular type which have starred this record.
# File lib/acts_as_starable/starable.rb, line 40 def starers_by_type(starer_type, options={}) starings_by_type(starer_type, options).collect { |f| f.starer } end
starings_by_type(starer_type, options={})
click to toggle source
Returns the star records related to this instance by type.
# File lib/acts_as_starable/starable.rb, line 34 def starings_by_type(starer_type, options={}) starings_scope = starings_scoped.for_starer_type(starer_type) starings_scope = apply_options_to_scope(starings_scope, options) end
starings_count()
click to toggle source
Returns the number of objects that have starred this instance.
# File lib/acts_as_starable/starable.rb, line 24 def starings_count self.starings.count end
starings_scoped()
click to toggle source
returns the star records to the current instance
# File lib/acts_as_starable/starable.rb, line 29 def starings_scoped self.starings.includes(:starer) end
starred_by?(starer)
click to toggle source
Returns true if the current instance has been starred by the passed record
# File lib/acts_as_starable/starable.rb, line 19 def starred_by?(starer) self.starings.for_starer(starer).first.present? end