diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-13 10:39:36 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-13 10:39:36 +0000 |
commit | 594589e0ecc09a24b7b70fe5408a63b9b1af3c19 (patch) | |
tree | 5ed4e3f03fa1bc4ac067e9230769d4c7629c639f /app/models | |
parent | 0087d237f76458f0db7ec552de2972e1d70c3838 (diff) | |
download | redmine-594589e0ecc09a24b7b70fe5408a63b9b1af3c19.tar.gz redmine-594589e0ecc09a24b7b70fe5408a63b9b1af3c19.zip |
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
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/issue.rb | 6 |
1 files 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 |