From d6b26a6040db97a55e23a7f10f2e9ba859eb11dc Mon Sep 17 00:00:00 2001 From: Olek Janiszewski Date: Sun, 12 Feb 2012 13:32:53 +0100 Subject: Add HTML5 input[type="date"] helper --- actionpack/lib/action_view/helpers/tags/date_field.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 actionpack/lib/action_view/helpers/tags/date_field.rb (limited to 'actionpack/lib/action_view/helpers/tags/date_field.rb') diff --git a/actionpack/lib/action_view/helpers/tags/date_field.rb b/actionpack/lib/action_view/helpers/tags/date_field.rb new file mode 100644 index 0000000000..bb968e9f39 --- /dev/null +++ b/actionpack/lib/action_view/helpers/tags/date_field.rb @@ -0,0 +1,15 @@ +module ActionView + module Helpers + module Tags + class DateField < TextField #:nodoc: + def render + options = @options.stringify_keys + options["value"] = @options.fetch("value") { value(object).try(:to_date) } + options["size"] = nil + @options = options + super + end + end + end + end +end -- cgit v1.2.3