Hi Dylan,
You can download version 0.2 now. Now you can pass in an array of
object_names and have them consolidated in one error container.
As I said before, it doesnāt properly handle duplicate column names,
last
column defined wins. All the other enhancements will continue to work
though, so you can intermix the order of the errors between the objects
to
match your form layout.
You will probably want to override the :header as it substitutes the
first
object_name passed in when referring to the object it has errors for.
Let me know how it works for you.
<%= error_messages_for [āobject_1ā, āobject_2ā], :header => āWhoops,
please
fix these errors and try again.ā %>
http://www.railtie.net/plugins/error_messages_for-0.2.zip
Cheers,
Bob S.
http://www.railtie.net/
From: [email protected]
[mailto:[email protected]] On Behalf Of Dylan S.
Sent: Friday, January 27, 2006 11:35 AM
To: [email protected]
Subject: Re: [Rails] Multiple Model Validation
Ahhā¦ excellent, thanks Bob !
This seems like a ticketable itemā¦ and, I would have to say your
validates_numericality_of extensions should be too. +1 vote for you
throwing that in as an enhancement request
On 1/27/06, Bob S. [email protected] wrote:
Hi Dylan,
This is something I was planning on adding to my Enhances Rails Errors
plugin, maybe I can take a quick look and see what it would take.
Iāll get back to you in an hour or two. I can make error_messages_for
take a
hash of objects, but the problem is dealing with duplicate column_names
and
the default header text displayed.
Handling the default header can be accomplished by using the :header
option
in the plugin. Duplicate column names is a bit more complex.
For now, I will forego duplicate name handling until I can engineer an
easy
solution that works with the other functionality of the plugin
Bob S.
http://www.railtie.net/
From: [email protected]
[mailto:[email protected]] On Behalf Of Dylan S.
Sent: Friday, January 27, 2006 11:19 AM
To: [email protected]
Subject: [Rails] Multiple Model Validation
Hey All !
I have a form which contains two models. I would like both models to be
validated, but have their validations aggregated on the page.
If I do:
<%= error_messages_for(:model1) %>
<%= error_messages_for(:model2) %>
It puts two big validation blocks on the page. I would like all the
errors
from both models, but only in one validation box.
Is this possible ? All my attempts have failed thus far