Skip to content

Commit

Permalink
Add scope to filter just users with email
Browse files Browse the repository at this point in the history
  • Loading branch information
vpereira committed Aug 12, 2020
1 parent 3834fae commit 9a9582c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class User < ApplicationRecord
all_without_nobody.includes(:owner).select(:id, :login, :email, :state, :realname, :owner_id, :updated_at, :ignore_auth_services)
}

scope :with_email, -> { where.not(email: [nil, '']) }

scope :recently_seen, -> { where('last_logged_in_at > ?', 3.months.ago) }

validates :login, :state, presence: { message: 'must be given' }
Expand Down

0 comments on commit 9a9582c

Please sign in to comment.