module ActsAsStarable::StarScopes

Public Instance Methods

descending() click to toggle source
# File lib/acts_as_starable/star_scopes.rb, line 24
def descending
  order("stars.created_at DESC")
end
for_starable(starable) click to toggle source
# File lib/acts_as_starable/star_scopes.rb, line 8
def for_starable(starable)
  where(starable_id: starable.id, starable_type: parent_class_name(starable))
end
for_starable_type(starable_type) click to toggle source
# File lib/acts_as_starable/star_scopes.rb, line 16
def for_starable_type(starable_type)
  where(starable_type: starable_type)
end
for_starer(starer) click to toggle source
# File lib/acts_as_starable/star_scopes.rb, line 4
def for_starer(starer)
  where(starer_id: starer.id, starer_type: parent_class_name(starer))
end
for_starer_type(starer_type) click to toggle source
# File lib/acts_as_starable/star_scopes.rb, line 12
def for_starer_type(starer_type)
  where(starer_type: starer_type)
end
recent(from) click to toggle source
# File lib/acts_as_starable/star_scopes.rb, line 20
def recent(from)
  where(["created_at > ?", (from || 2.weeks.ago).to_s(:db)])
end