discourse/app/models/user_visit.rb

9 lines
250 B
Ruby
Raw Normal View History

2013-02-05 14:16:51 -05:00
class UserVisit < ActiveRecord::Base
attr_accessible :visited_at, :user_id
# A list of visits in the last month by day
2013-03-07 11:07:59 -05:00
def self.by_day(since=30.days.ago)
where("visited_at > ?", since).group(:visited_at).order(:visited_at).count
end
2013-02-05 14:16:51 -05:00
end