discourse/app/models/user_visit.rb

9 lines
265 B
Ruby
Raw Normal View History

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