Module: ActsAsFootprintable::Extenders::Footprintable

Defined in:
lib/acts_as_footprintable/extenders/footprintable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_footprintableObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/acts_as_footprintable/extenders/footprintable.rb', line 6

def footprintable?
  false
end