Multiple Forms on the Same Page with Rails
- by Eric Koslow
So I'm building a rails app for high school students and I've hit a problem when it comes to creating users.
I want the students to only be able to create accounts if they select their school and type in their school's password correctly.
What is the correct / easiest way of doing this? Should I create a gatekeeper to the user#new action that they have to pass first or if their a way that on the same page a student can submit to forms. One would be the regular username, email, password using:
form_for @user do
...
end
But then creating another form for the high-school / high-school password selection.
Ideally the controller would be able to get the params of the high-school form, validate those, then go on to create the user from the user params.
Is this possible using rails?
My setup: Rails 3 and Ruby 1.9.2dev
Thank you!