From 594589e0ecc09a24b7b70fe5408a63b9b1af3c19 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 13 Jul 2013 10:39:36 +0000 Subject: [PATCH] Use Hash#reject that returns a Hash with ruby1.8 when Hash#select that returns an Array. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12016 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 69ace9f31..a089f4067 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -453,12 +453,14 @@ class Issue < ActiveRecord::Base if attrs['custom_field_values'].present? editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s} - attrs['custom_field_values'] = attrs['custom_field_values'].select {|k, v| editable_custom_field_ids.include? k.to_s} + # TODO: use #select when ruby1.8 support is dropped + attrs['custom_field_values'] = attrs['custom_field_values'].reject {|k, v| !editable_custom_field_ids.include?(k.to_s)} end if attrs['custom_fields'].present? editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s} - attrs['custom_fields'] = attrs['custom_fields'].select {|c| editable_custom_field_ids.include? c['id'].to_s} + # TODO: use #select when ruby1.8 support is dropped + attrs['custom_fields'] = attrs['custom_fields'].reject {|c| !editable_custom_field_ids.include?(c['id'].to_s)} end # mass-assignment security bypass -- 2.39.5