Created
March 3, 2015 20:01
-
-
Save lfzawacki/a2ee6d7072882f10c1de to your computer and use it in GitHub Desktop.
Users logged last month
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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