summaryrefslogtreecommitdiffstats
path: root/app/controllers/context_menus_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-09 20:06:36 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-09 20:06:36 +0000
commit8c38510ee5045447a0be063596c888a678521b7b (patch)
treed2114936eee4bba4cb5ed9163a26bb36c9bd700e /app/controllers/context_menus_controller.rb
parent8b3ed4175d6e9d09175c1bea6f01b03079918f80 (diff)
downloadredmine-8c38510ee5045447a0be063596c888a678521b7b.tar.gz
redmine-8c38510ee5045447a0be063596c888a678521b7b.zip
Use #reduce instead of #inject for getting the intersection of arrays.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8827 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/context_menus_controller.rb')
-rw-r--r--app/controllers/context_menus_controller.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb
index fa7caf4e0..dbfa4057e 100644
--- a/app/controllers/context_menus_controller.rb
+++ b/app/controllers/context_menus_controller.rb
@@ -8,7 +8,7 @@ class ContextMenusController < ApplicationController
@issue = @issues.first
end
- @allowed_statuses = @issues.map(&:new_statuses_allowed_to).inject{|memo,a| memo & a}
+ @allowed_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
@projects = @issues.collect(&:project).compact.uniq
@project = @projects.first if @projects.size == 1
@@ -28,8 +28,8 @@ class ContextMenusController < ApplicationController
@trackers = @project.trackers
else
#when multiple projects, we only keep the intersection of each set
- @assignables = @projects.map(&:assignable_users).inject{|memo,a| memo & a}
- @trackers = @projects.map(&:trackers).inject{|memo,t| memo & t}
+ @assignables = @projects.map(&:assignable_users).reduce(:&)
+ @trackers = @projects.map(&:trackers).reduce(:&)
end
@priorities = IssuePriority.active.reverse
@@ -37,7 +37,7 @@ class ContextMenusController < ApplicationController
@options_by_custom_field = {}
if @can[:edit]
- custom_fields = @issues.map(&:available_custom_fields).inject {|memo, f| memo & f}.select do |f|
+ custom_fields = @issues.map(&:available_custom_fields).reduce(:&).select do |f|
%w(bool list user version).include?(f.field_format) && !f.multiple?
end
custom_fields.each do |field|