aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-10-29 11:15:34 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-10-29 11:15:34 -0600
commit3fc2b77e7a33a62fb3e189dbf6cea23dd1dd2937 (patch)
tree8073c86c3f1e025e0e279db2ed1492081dada441 /actionview/lib
parent857a34a41622300457c0a52885d53344a3e36505 (diff)
parentf2ae4af9e122fd1daa95fd7249bdcf1068ebeecb (diff)
downloadrails-3fc2b77e7a33a62fb3e189dbf6cea23dd1dd2937.tar.gz
rails-3fc2b77e7a33a62fb3e189dbf6cea23dd1dd2937.tar.bz2
rails-3fc2b77e7a33a62fb3e189dbf6cea23dd1dd2937.zip
Merge pull request #16252 from leckylao/actionview-date-helpers-selected-value-to-accept-hash-like-default
making date_helper selected value to accept Hash like the default option
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/date_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb
index 312e41ee48..233e613e97 100644
--- a/actionview/lib/action_view/helpers/date_helper.rb
+++ b/actionview/lib/action_view/helpers/date_helper.rb
@@ -845,7 +845,12 @@ module ActionView
private
%w( sec min hour day month year ).each do |method|
define_method(method) do
- @datetime.kind_of?(Numeric) ? @datetime : @datetime.send(method) if @datetime
+ case @datetime
+ when Hash then @datetime[method.to_sym]
+ when Numeric then @datetime
+ when nil then nil
+ else @datetime.send(method)
+ end
end
end