1

I was wondering whether it was possible to have two forms on the same page which maps to two different controllers in a rails application

In my routes file, I mapped the root route to new action of the user controllers

root to: 'users#new'

The new page basically renders a signup form.

sign-up form

On the header of the same page, I happen to have a login in form which I am intending on routing to another controller

login-form

The signup form currently re-directs to the proper controller#action but was wondering if I could direct the login to a whole new controller/action

1 Answer 1

1

I'm sorry if mistakenly understood your question.

If you want to have multiple forms (or links) to differente controller(or same controller and just another action) on the same page, there should be no problem, since the path to the action is explicitly passed on to the form:

<%= form_for path_to_controller_action_path(id,...), etc. %>

or for links:

<%= link_to "label", path_to_controller_action(id,...) %>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.