From 024f2aef6c8b953503cb1ea0102729c556004260 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 20 Aug 2019 03:27:15 +0000 Subject: 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 --- app/models/project.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'app') 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| -- cgit v1.2.3