diff options
author | Brian Lopez <seniorlopez@gmail.com> | 2010-08-02 13:30:08 -0700 |
---|---|---|
committer | Brian Lopez <seniorlopez@gmail.com> | 2010-08-02 13:30:08 -0700 |
commit | 954de9940b8f212cafdb9f5e97abc83d27b3e4ff (patch) | |
tree | 2cc9e60c1967cc217d55dcb187c4bcfc24c44cd5 /actionpack | |
parent | 2353e826b0446917eb655b60c47533f5a9c2a07f (diff) | |
parent | 88b5f938cf7d3eb26ad204451a4dbb9c2cf4f571 (diff) | |
download | rails-954de9940b8f212cafdb9f5e97abc83d27b3e4ff.tar.gz rails-954de9940b8f212cafdb9f5e97abc83d27b3e4ff.tar.bz2 rails-954de9940b8f212cafdb9f5e97abc83d27b3e4ff.zip |
Merge branch 'master' into mysql2
* master:
Bring returning back to ease migration.
Remove duplicated logic.
Eager loading an association should not change the count of children
fix loading of different elements in array then int and string [#5036 state:resolved]
Tidy up previous commit.
test and fix collection_singular_ids= with string primary keys [#5125 state:resolved]
Handle edge cases in the previous patch.
Improved how AppGenerator generates the application name. It now detects the current app name whenever possible. This means that renaming the residing directory will not effect the app name generated by AppGenerator.
ActiveModel::Errors json serialization to work as Rails 3b4 [#5254 state:resolved]
Add missing require in ActiveSupport::HashWithIndifferentAccess [#5189 state:resolved]
Add an internal (private API) after_touch callback. [#5271 state:resolved]
added failing touch propagation test
Makes rails destroy scaffold don't duplicate routes.draw do |map| |map| when using the deprecated syntax
Failing test to check for route file corruption if legacy map parameter is used. [#5263 state:open]
Corrected the rake test:units and test:functionals description [#5251 state:committed]
Use AS::OrderedHash when trusting in the order of the hash
Fix label form helper to use I18n and html options, without the need of 'nil' text param:
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 7 | ||||
-rw-r--r-- | actionpack/test/controller/test_test.rb | 5 | ||||
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 11 |
3 files changed, 16 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index f8e60faa2a..ebe055bebd 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -215,7 +215,7 @@ module ActionView # ... # <% end %> # - # If your resource has associations defined, for example, you want to add comments + # If your resource has associations defined, for example, you want to add comments # to the post given that the routes are set correctly: # # <%= form_for([@document, @comment]) do |f| %> @@ -583,8 +583,9 @@ module ActionView # 'Accept <a href="/terms">Terms</a>.' # end def label(object_name, method, content_or_options = nil, options = nil, &block) - if block_given? - options = content_or_options if content_or_options.is_a?(Hash) + content_is_options = content_or_options.is_a?(Hash) + if content_is_options || block_given? + options = content_or_options if content_is_options text = nil else text = content_or_options diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 950ad9266f..13c9d9ee38 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -1,5 +1,6 @@ require 'abstract_unit' require 'controller/fake_controllers' +require 'active_support/ordered_hash' class TestTest < ActionController::TestCase class TestController < ActionController::Base @@ -137,14 +138,14 @@ XML end def test_raw_post_handling - params = {:page => {:name => 'page name'}, 'some key' => 123} + params = ActiveSupport::OrderedHash[:page, {:name => 'page name'}, 'some key', 123] post :render_raw_post, params.dup assert_equal params.to_query, @response.body end def test_body_stream - params = { :page => { :name => 'page name' }, 'some key' => 123 } + params = ActiveSupport::OrderedHash[:page, { :name => 'page name' }, 'some key', 123] post :render_body, params.dup diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index f248a38ae9..9086a23345 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -120,6 +120,13 @@ class FormHelperTest < ActionView::TestCase I18n.locale = old_locale end + def test_label_with_locales_and_options + old_locale, I18n.locale = I18n.locale, :label + assert_dom_equal('<label for="post_body" class="post_body">Write entire text here</label>', label(:post, :body, :class => 'post_body')) + ensure + I18n.locale = old_locale + end + def test_label_with_for_attribute_as_symbol assert_dom_equal('<label for="my_for">Title</label>', label(:post, :title, nil, :for => "my_for")) end @@ -620,7 +627,7 @@ class FormHelperTest < ActionView::TestCase def test_form_for_with_symbol_object_name form_for(@post, :as => "other_name", :html => { :id => 'create-post' }) do |f| - concat f.label(:title) + concat f.label(:title, :class => 'post_title') concat f.text_field(:title) concat f.text_area(:body) concat f.check_box(:secret) @@ -628,7 +635,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/posts/123", "create-post", "other_name_edit", :method => "put") do - "<label for='other_name_title'>Title</label>" + + "<label for='other_name_title' class='post_title'>Title</label>" + "<input name='other_name[title]' size='30' id='other_name_title' value='Hello World' type='text' />" + "<textarea name='other_name[body]' id='other_name_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" + "<input name='other_name[secret]' value='0' type='hidden' />" + |