diff options
Diffstat (limited to 'actionpack/lib/action_view/helpers/active_record_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/active_record_helper.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb index 7a1aeff342..a001ae5e65 100644 --- a/actionpack/lib/action_view/helpers/active_record_helper.rb +++ b/actionpack/lib/action_view/helpers/active_record_helper.rb @@ -167,6 +167,8 @@ module ActionView to_date_select_tag(options) when :datetime, :timestamp to_datetime_select_tag(options) + when :time + to_time_select_tag(options) when :boolean to_boolean_select_tag(options) end @@ -208,6 +210,15 @@ module ActionView end end + alias_method :to_time_select_tag_without_error_wrapping, :to_time_select_tag + def to_time_select_tag(options = {}) + if object.respond_to?("errors") && object.errors.respond_to?("on") + error_wrapping(to_time_select_tag_without_error_wrapping(options), object.errors.on(@method_name)) + else + to_time_select_tag_without_error_wrapping(options) + end + end + def error_wrapping(html_tag, has_error) has_error ? Base.field_error_proc.call(html_tag, self) : html_tag end |