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