diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-11-09 13:25:19 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-11-09 13:25:19 +0000 |
commit | b2e81eecf25dba60f19f74b82f70d590f88330ee (patch) | |
tree | 8c1d80b696f9773bf62e83af2a02e584cf876902 /app/models/user.rb | |
parent | 96acbee6d3f85fd2826ca1c30b6cd703f7bed8a7 (diff) | |
download | redmine-b2e81eecf25dba60f19f74b82f70d590f88330ee.tar.gz redmine-b2e81eecf25dba60f19f74b82f70d590f88330ee.zip |
use "do end" instead of {} at ActiveRecord scope lambda of app/models/user.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20318 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index c859994ed..2f88713ca 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -132,27 +132,27 @@ class User < Principal after_save :update_notified_project_ids, :destroy_tokens, :deliver_security_notification after_destroy :deliver_security_notification - scope :admin, lambda {|*args| + scope :admin, (lambda do |*args| admin = args.size > 0 ? !!args.first : true where(:admin => admin) - } - scope :in_group, lambda {|group| + end) + scope :in_group, (lambda do |group| group_id = group.is_a?(Group) ? group.id : group.to_i where("#{User.table_name}.id IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id) - } - scope :not_in_group, lambda {|group| + end) + scope :not_in_group, (lambda do |group| group_id = group.is_a?(Group) ? group.id : group.to_i where("#{User.table_name}.id NOT IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id) - } + end) scope :sorted, lambda {order(*User.fields_for_order_statement)} - scope :having_mail, lambda {|arg| + scope :having_mail, (lambda do |arg| addresses = Array.wrap(arg).map {|a| a.to_s.downcase} if addresses.any? joins(:email_addresses).where("LOWER(#{EmailAddress.table_name}.address) IN (?)", addresses).distinct else none end - } + end) def set_mail_notification self.mail_notification = Setting.default_notification_option if self.mail_notification.blank? |