##// END OF EJS Templates
Don't use alias_chain_method....
Jean-Philippe Lang -
r15278:9d9e26317a61
parent child
Show More
@@ -70,35 +70,35 module ActionView
70 module Tags
70 module Tags
71 class Base
71 class Base
72 private
72 private
73 def add_options_with_non_empty_blank_option(option_tags, options, value = nil)
73 alias :add_options_without_non_empty_blank_option :add_options
74 def add_options(option_tags, options, value = nil)
74 if options[:include_blank] == true
75 if options[:include_blank] == true
75 options = options.dup
76 options = options.dup
76 options[:include_blank] = ' '.html_safe
77 options[:include_blank] = ' '.html_safe
77 end
78 end
78 add_options_without_non_empty_blank_option(option_tags, options, value)
79 add_options_without_non_empty_blank_option(option_tags, options, value)
79 end
80 end
80 alias_method_chain :add_options, :non_empty_blank_option
81 end
81 end
82 end
82 end
83
83
84 module FormTagHelper
84 module FormTagHelper
85 def select_tag_with_non_empty_blank_option(name, option_tags = nil, options = {})
85 alias :select_tag_without_non_empty_blank_option :select_tag
86 def select_tag(name, option_tags = nil, options = {})
86 if options.delete(:include_blank)
87 if options.delete(:include_blank)
87 options[:prompt] = ' '.html_safe
88 options[:prompt] = ' '.html_safe
88 end
89 end
89 select_tag_without_non_empty_blank_option(name, option_tags, options)
90 select_tag_without_non_empty_blank_option(name, option_tags, options)
90 end
91 end
91 alias_method_chain :select_tag, :non_empty_blank_option
92 end
92 end
93
93
94 module FormOptionsHelper
94 module FormOptionsHelper
95 def options_for_select_with_non_empty_blank_option(container, selected = nil)
95 alias :options_for_select_without_non_empty_blank_option :options_for_select
96 def options_for_select(container, selected = nil)
96 if container.is_a?(Array)
97 if container.is_a?(Array)
97 container = container.map {|element| element.blank? ? [" ".html_safe, ""] : element}
98 container = container.map {|element| element.blank? ? [" ".html_safe, ""] : element}
98 end
99 end
99 options_for_select_without_non_empty_blank_option(container, selected)
100 options_for_select_without_non_empty_blank_option(container, selected)
100 end
101 end
101 alias_method_chain :options_for_select, :non_empty_blank_option
102 end
102 end
103 end
103 end
104 end
104 end
General Comments 0
You need to be logged in to leave comments. Login now