From 462698b2c704eff962060ed5851af80f4215958b Mon Sep 17 00:00:00 2001 From: Lecky Lao Date: Tue, 22 Jul 2014 16:03:55 +1000 Subject: 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 --- actionview/lib/action_view/helpers/date_helper.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'actionview/lib/action_view') 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 -- cgit v1.2.3