Skip to content

Instantly share code, notes, and snippets.

@lfzawacki
Created Mar 3, 2015
Embed
What would you like to do?
Users logged last month
class User < ActiveRecord::Base
def self.login_last_month
self.select { |u| u.last_sign_in_at && (u.last_sign_in_at + 30.days) >= Date.today }.count
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment