diff options
author | Lecky Lao <leckylao@au1.ibm.com> | 2014-07-22 16:03:55 +1000 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-29 11:02:31 -0600 |
commit | 462698b2c704eff962060ed5851af80f4215958b (patch) | |
tree | e0d0b1274ce5386a046fb5b94f95d08093534996 /actionview/lib/action_view | |
parent | 857a34a41622300457c0a52885d53344a3e36505 (diff) | |
download | rails-462698b2c704eff962060ed5851af80f4215958b.tar.gz rails-462698b2c704eff962060ed5851af80f4215958b.tar.bz2 rails-462698b2c704eff962060ed5851af80f4215958b.zip |
making selected value to accept Hash like the default option. E.g. selected: {day: params[:day].to_i, month: params[:month].to_id}
Adds in test test_date_select_with_selected_in_hash and change log
fixes typo in CHANGELOG
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/helpers/date_helper.rb | 10 |
1 files changed, 9 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..c69e4cc77e 100644 --- a/actionview/lib/action_view/helpers/date_helper.rb +++ b/actionview/lib/action_view/helpers/date_helper.rb @@ -845,7 +845,15 @@ 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 + if @datetime + if @datetime.kind_of?(Hash) + @datetime[method.to_sym] + elsif @datetime.kind_of?(Numeric) + @datetime + else + @datetime.send(method) + end + end end end |