Topic: How does Rails process forms?

The reason I ask is because I'm trying to troubleshoot a bug on my app where it seems that one of the two forms is submitting both of them.

I want to see if I can learn what's happening and troubleshoot this myself instead of just getting an answer from the net... that way I can use that knowledge to assist me later..

So yea...

How do forms work in relation to controllers and actions?

Thanks!

Re: How does Rails process forms?

Hi
As far as I know and understand, a rails form in your app is related to a specific model by the 'form_for myobject'.
Rails use REST with the actions in your controller.

So when you have a form to create an Article, given you have a Model named "Article" and the associated controller with actions new and create')
1 - when you reach the form you call the action 'new' of the articles controller (Rails deduce the name of controller from the form_for)
2 - when you submit the form Rails calls (as it knows which controller is invoked) the 'create' action.

If you want to ensure a specific controller/action is called when you submit a form you can specify the url something like

   <%= form_for @article, :url => new_admin_article_path %> 

will send the submit action to the controller "app/controllers/admin/articles_controller.rb"  (instead of the default "app/controllers/articles_controller.rb") where it find the "create" action and execute it (after all validations are done)

I hope I was clear (english is not my native tongue) and this short explanation is of some help
Cheers