How can I separate error_messages from two forms on one page?

Posted by itkevin on Stack Overflow See other posts from Stack Overflow or by itkevin
Published on 2010-06-09T20:07:56Z Indexed on 2010/06/09 20:12 UTC
Read the original article Hit count: 183

Filed under:
|
|

I have two forms in one view updating the User Profile. One Form is to Update my name etc. and one is to change my password.

Profile Form:

- form_for @user, :url => account_path do |f|
  = f.error_messages
  ...form fields here...

Password Form:

- form_for @user, :url => account_path do |pf|
  = pf.error_messages
  ...password fields here...

As you can see they both point to the same update action in the users controller. If I type in a invalid password both error_messages show me the same error message.

How can I output separate error messages per form?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby