2: def index
3: @dep_id = 0
4: @hours = params[:hours].to_i || 4
5:
6:
7:
8:
9:
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