Class | Admin::StatsController
In: | app/controllers/admin/stats_controller.rb
Parent: | Admin::BaseController

### Methods

index

### Public Instance methods

index()

[Source]

        # File app/controllers/admin/stats_controller.rb, line 2
     2:   def index
     3:     @dep_id = 0
     4:     @hours = params[:hours].to_i || 4
     5:
     6:     # referers = `ruby #{RAILS_ROOT}/misc/cdb-last-referers.rb`
     7:     # logger.info "111111111 #{referers}"
     8:     # @referers = referers.split("\n")
     9:     # logger.info "AAAAAAAA #{@referers.length}: #{@referers.last}"
    10:
    11:     @last_ips_counter = Stats.last_ips_counter
    12:
    13:     @referers = Stats.last_referers(@hours)
    14:
    15:     @googles = Stats.last_googles
    16:
    17:     @top_pages = Stats.top_pages(@hours)
    18:
    19:     @comments = Comment.find :all,
    20:       :select => "commentable_id, commentable_type, count(id)",
    21:       :conditions => ["created_at between now()-?::interval and now()", "#{@hours} hours"],
    22:       :group => "commentable_id, commentable_type",
    23:       :order => "count desc",
    24:       :limit => 10
    25:   end

[Validate]