From d9b9d993c28ce45566608754afc11b580dfd2293 Mon Sep 17 00:00:00 2001 From: Marc Lainez Date: Thu, 6 May 2010 14:32:20 +0200 Subject: [PATCH 1/2] added support for html attributes in options_for_select [#2165] --- .../lib/action_view/helpers/form_options_helper.rb | 29 +++++++--- .../test/template/form_options_helper_test.rb | 58 ++++++++++++++++++-- 2 files changed, 72 insertions(+), 15 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 8f8db54..fe3c7aa 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -52,16 +52,16 @@ module ActionView # # # - # - # Like the other form helpers, +select+ can accept an :index option to manually set the ID used in the resulting output. Unlike other helpers, +select+ expects this + # + # Like the other form helpers, +select+ can accept an :index option to manually set the ID used in the resulting output. Unlike other helpers, +select+ expects this # option to be in the +html_options+ parameter. - # - # Example: - # + # + # Example: + # # select("album[]", "genre", %w[rap rock country], {}, { :index => nil }) - # + # # becomes: - # + # # \n\n", output_buffer @@ -416,11 +416,11 @@ class FormOptionsHelperTest < ActionView::TestCase def test_select_with_index_option @album = Album.new @album.id = 1 - - expected = "" + + expected = "" assert_dom_equal( - expected, + expected, select("album[]", "genre", %w[rap rock country], {}, { :index => nil }) ) end @@ -469,7 +469,7 @@ class FormOptionsHelperTest < ActionView::TestCase output_buffer = fields_for :post, @post do |f| concat f.collection_select(:author_name, dummy_posts, :author_name, :author_name) end - + assert_dom_equal( "", output_buffer @@ -577,7 +577,7 @@ class FormOptionsHelperTest < ActionView::TestCase output_buffer = fields_for :firm, @firm do |f| concat f.time_zone_select(:time_zone) end - + assert_dom_equal( "