module ActsAsFootprintable::Extenders::Footprintable

Public Class Methods

access_ranking(range = nil, limit = nil) click to toggle source
# File lib/acts_as_footprintable/extenders/footprintable.rb, line 19
def self.access_ranking(range = nil, limit = nil)
  records = Footprint.for_type(self)
  records = records.where(created_at: range) unless range.nil?
  records = records.limit(limit) unless limit.nil?
  records.group(:footprintable_id).order('count_footprintable_id desc').count(:footprintable_id)
end
footprintable?() click to toggle source
# File lib/acts_as_footprintable/extenders/footprintable.rb, line 15
def self.footprintable?
  true
end

Public Instance Methods

acts_as_footprintable() click to toggle source
# File lib/acts_as_footprintable/extenders/footprintable.rb, line 10
def acts_as_footprintable
  require 'acts_as_footprintable/footprintable'
  include ActsAsFootprintable::Footprintable

  class_eval do
    def self.footprintable?
      true
    end

    def self.access_ranking(range = nil, limit = nil)
      records = Footprint.for_type(self)
      records = records.where(created_at: range) unless range.nil?
      records = records.limit(limit) unless limit.nil?
      records.group(:footprintable_id).order('count_footprintable_id desc').count(:footprintable_id)
    end
  end
end
footprintable?() click to toggle source
# File lib/acts_as_footprintable/extenders/footprintable.rb, line 6
def footprintable?
  false
end