From 3e5f1e326aef37943268410994aeaf2481d5db75 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 14 Dec 2013 09:24:37 +0000 Subject: [PATCH] ruby1.8 compatibility. git-svn-id: http://svn.redmine.org/redmine/trunk@12404 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/field_format.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb index f0f83cccb..399f7d150 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -39,8 +39,7 @@ module Redmine # Return an array of custom field formats which can be used in select_tag def self.as_select(class_name=nil) - formats = all.values - formats.select! do |format| + formats = all.values.select do |format| format.class.customized_class_names.nil? || format.class.customized_class_names.include?(class_name) end formats.map {|format| [::I18n.t(format.label), format.name] }.sort_by(&:first) @@ -547,7 +546,8 @@ module Redmine missing = [custom_value.value_was].flatten.reject(&:blank?) - options.map(&:last) if missing.any? options += target_class.find_all_by_id(missing.map(&:to_i)).map {|o| [o.to_s, o.id.to_s]} - options.sort_by!(&:first) + #TODO: use #sort_by! when ruby1.8 support is dropped + options = options.sort_by(&:first) end options end