diff options
author | Go MAEDA <maeda@farend.jp> | 2019-08-20 03:27:15 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-08-20 03:27:15 +0000 |
commit | 024f2aef6c8b953503cb1ea0102729c556004260 (patch) | |
tree | 4c437b2a177091175c391093a71b1811b1be6e8d /app | |
parent | 3495cba92bd8a2448381e01056920b48dd882180 (diff) | |
download | redmine-024f2aef6c8b953503cb1ea0102729c556004260.tar.gz redmine-024f2aef6c8b953503cb1ea0102729c556004260.zip |
Code cleanup: RuboCop: Fix Style/IdenticalConditionalBranches in app/models/project.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@18380 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 88d1c6eb5..1e925751a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -93,14 +93,8 @@ class Project < ActiveRecord::Base scope :all_public, lambda { where(:is_public => true) } scope :visible, lambda {|*args| where(Project.visible_condition(args.shift || User.current, *args)) } scope :allowed_to, lambda {|*args| - user = User.current - permission = nil - if args.first.is_a?(Symbol) - permission = args.shift - else - user = args.shift - permission = args.shift - end + user = args.first.is_a?(Symbol) ? User.current : args.shift + permission = args.shift where(Project.allowed_to_condition(user, permission, *args)) } scope :like, lambda {|arg| |