##// END OF EJS Templates
ruby1.8 compatibility....
Jean-Philippe Lang -
r12129:3e5f1e326aef
parent child
Show More
@@ -39,8 +39,7 module Redmine
39
39
40 # Return an array of custom field formats which can be used in select_tag
40 # Return an array of custom field formats which can be used in select_tag
41 def self.as_select(class_name=nil)
41 def self.as_select(class_name=nil)
42 formats = all.values
42 formats = all.values.select do |format|
43 formats.select! do |format|
44 format.class.customized_class_names.nil? || format.class.customized_class_names.include?(class_name)
43 format.class.customized_class_names.nil? || format.class.customized_class_names.include?(class_name)
45 end
44 end
46 formats.map {|format| [::I18n.t(format.label), format.name] }.sort_by(&:first)
45 formats.map {|format| [::I18n.t(format.label), format.name] }.sort_by(&:first)
@@ -547,7 +546,8 module Redmine
547 missing = [custom_value.value_was].flatten.reject(&:blank?) - options.map(&:last)
546 missing = [custom_value.value_was].flatten.reject(&:blank?) - options.map(&:last)
548 if missing.any?
547 if missing.any?
549 options += target_class.find_all_by_id(missing.map(&:to_i)).map {|o| [o.to_s, o.id.to_s]}
548 options += target_class.find_all_by_id(missing.map(&:to_i)).map {|o| [o.to_s, o.id.to_s]}
550 options.sort_by!(&:first)
549 #TODO: use #sort_by! when ruby1.8 support is dropped
550 options = options.sort_by(&:first)
551 end
551 end
552 options
552 options
553 end
553 end
General Comments 0
You need to be logged in to leave comments. Login now