diff options
author | Vasiliy Ermolovich <younash@gmail.com> | 2012-08-23 21:59:22 +0300 |
---|---|---|
committer | Vasiliy Ermolovich <younash@gmail.com> | 2012-08-25 18:48:14 +0300 |
commit | 4b1985578a2b27b170358e82e72e00d23fdaf087 (patch) | |
tree | 2ffa67a03e2ab280177a7df34bf8f16737b3e249 /actionpack/lib/action_view/helpers | |
parent | b76a96320e967d158d5979b613f8cabad28b7034 (diff) | |
download | rails-4b1985578a2b27b170358e82e72e00d23fdaf087.tar.gz rails-4b1985578a2b27b170358e82e72e00d23fdaf087.tar.bz2 rails-4b1985578a2b27b170358e82e72e00d23fdaf087.zip |
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
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/date_helper.rb | 7 |
1 files changed, 5 insertions, 2 deletions
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) # => "<input id="post_written_on_1i" name="post[written_on(1i)]" type="hidden" value="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. |