Skip to content

Instantly share code, notes, and snippets.

@lfzawacki
Created March 3, 2015 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfzawacki/a2ee6d7072882f10c1de to your computer and use it in GitHub Desktop.
Save lfzawacki/a2ee6d7072882f10c1de to your computer and use it in GitHub Desktop.
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