aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/active_record_helper.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-12-06 19:15:24 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-12-06 19:15:24 +0000
commit07423bed4bf00626fcd9328557fa509fa86f6680 (patch)
tree7c0e46f7c1965c420cdb6ba5d578d293325262ae /actionpack/lib/action_view/helpers/active_record_helper.rb
parentcdad2d41e18977dd66518efddcb83c2107f0e057 (diff)
downloadrails-07423bed4bf00626fcd9328557fa509fa86f6680.tar.gz
rails-07423bed4bf00626fcd9328557fa509fa86f6680.tar.bz2
rails-07423bed4bf00626fcd9328557fa509fa86f6680.zip
Bob's raining patches: fixes date_helper bugs and usability issues. References #3811.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5685 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/active_record_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/active_record_helper.rb11
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