From b2e81eecf25dba60f19f74b82f70d590f88330ee Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Mon, 9 Nov 2020 13:25:19 +0000 Subject: [PATCH] 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 --- app/models/user.rb | 16 ++++++++-------- 1 file 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? -- 2.39.5