]> source.dussan.org Git - redmine.git/commitdiff
Use Hash#reject that returns a Hash with ruby1.8 when Hash#select that returns an...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 13 Jul 2013 10:39:36 +0000 (10:39 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 13 Jul 2013 10:39:36 +0000 (10:39 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12016 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb

index 69ace9f3131acc791f1e3efc6704f4cf57df1ee8..a089f40675d7d0f6be811862e4f70b34186b19fb 100644 (file)
@@ -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