Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added FormBuilder#submit as a delegate for FormTagHelper#submit_tag […

…DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6089 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 6b5238aadeb778a7067f93376a6a57a8eeda8379 1 parent 09c7089
@dhh dhh authored
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added FormBuilder#submit as a delegate for FormTagHelper#submit_tag [DHH]
+
* TestSession supports indifferent access so session['foo'] == session[:foo] in your tests. #7372 [julik, jean.helou]
* Allow Routes to generate all urls for a set of options by specifying :generate_all => true. Allows caching to properly set or expire all paths for a resource. References #1739. [Nicholas Seckar]
View
4 actionpack/lib/action_view/helpers/form_helper.rb
@@ -453,6 +453,10 @@ def error_message_on(method, prepend_text = "", append_text = "", css_class = "f
def error_messages(options = {})
@template.error_messages_for(@object_name, options)
end
+
+ def submit(value = "Save changes", options = {})
+ @template.submit_tag(value, options.reverse_merge(:id => "#{object_name}_submit"))
+ end
end
end
View
2  actionpack/test/template/form_helper_test.rb
@@ -239,6 +239,7 @@ def test_form_for
_erbout.concat f.text_field(:title)
_erbout.concat f.text_area(:body)
_erbout.concat f.check_box(:secret)
+ _erbout.concat f.submit 'Create post'
end
expected =
@@ -247,6 +248,7 @@ def test_form_for
"<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" +
"<input name='post[secret]' type='hidden' value='0' />" +
+ "<input name='commit' id='post_submit' type='submit' value='Create post' />" +
"</form>"
assert_dom_equal expected, _erbout
Please sign in to comment.
Something went wrong with that request. Please try again.