This project is archived and is in readonly mode.
[PATCH] error_message_on does not display error message when form builder is not passed object
Reported by Lachlan Sylvester | September 22nd, 2009 @ 10:46 AM
When form_for is invoked using a name and not an object, error_message_on returns an empty string instead of an error message.
form_for(:post) do |f|
concat f.error_message_on('author_name')
concat f.error_messages
end
Results in:
<form action='http://www.example.com' method='post'>
<div class="errorExplanation" id="errorExplanation">
<h2>1 error prohibited this post from being saved</h2>
<p>There were problems with the following fields:</p>
<ul><li>Author name can't be empty</li></ul>
</div>
</form>
This patch will pass in the @object_name if there is no @object.
Comments and changes to this ticket
-
CancelProfileIsBroken September 25th, 2009 @ 11:53 AM
- Tag changed from 2-3-stable, error_message_on, formbuilder to 2-3-stable, bugmash, error_message_on, formbuilder
-
John Guenin September 26th, 2009 @ 11:06 PM
+1 verified bug & patch. Applies cleanly to master & 2-3-stable. All tests pass.
Nice job, Lachlan :)
-
sr.iniv.t September 27th, 2009 @ 07:41 AM
+1 verified.
The patch applies cleanly on master and 2-3-stable and all tests pass.
-
Elad Meidar September 27th, 2009 @ 07:48 AM
+1 verified and patch applies on both 2-3-stable and master. maybe
@object_name.to_s
might also give you the option to usef.error_messages_for(:author_name)
-
CancelProfileIsBroken September 27th, 2009 @ 12:10 PM
- Tag changed from 2-3-stable, bugmash, error_message_on, formbuilder to 2-3-stable, bugmash-review, error_message_on, formbuilder
-
Repository April 10th, 2010 @ 01:03 PM
- State changed from new to resolved
(from [dae247316d83c9c2f1b3cc797e0d6fcf98d46f92]) made error_message_on work by passing in the object name if there is no object [#3246 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/dae247316d83c9c2f1b3cc797e0d6f... -
Rizwan Reza May 15th, 2010 @ 06:37 PM
- Tag changed from 2-3-stable, bugmash-review, error_message_on, formbuilder to 2-3-stable, error_message_on, formbuilder
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 3246 [PATCH] error_message_on does not display error message when form builder is not passed object (from [dae247316d83c9c2f1b3cc797e0d6fcf98d46f92]) made er...