From 4b1985578a2b27b170358e82e72e00d23fdaf087 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Thu, 23 Aug 2012 21:59:22 +0300 Subject: correct handling of date selects when using both disabled and discard options we should take disabled option not only from `html_options` hash but from `options` hash too like `build_select` method does it. So datetime_select("post", "updated_at", { :discard_minute => true }, { :disabled => true }) datetime_select("post", "updated_at", :discard_minute => true , :disabled => true) both these variants work now closes #7431 --- actionpack/lib/action_view/helpers/date_helper.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index c26f0d4911..87e2332c42 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -915,12 +915,15 @@ module ActionView # build_hidden(:year, 2008) # => "" def build_hidden(type, value) - (tag(:input, { + select_options = { :type => "hidden", :id => input_id_from_type(type), :name => input_name_from_type(type), :value => value - }.merge(@html_options.slice(:disabled))) + "\n").html_safe + }.merge(@html_options.slice(:disabled)) + select_options.merge!(:disabled => 'disabled') if @options[:disabled] + + tag(:input, select_options) + "\n".html_safe end # Returns the name attribute for the input tag. -- cgit v1.2.3