Reputation: 5862
I develop a new project using Rails 4.
In this project there is a sign-up form which should be located in different places.
Regardless of its location, the form action goes to the same controller and action. If everything is ok, user is redirected to its account settings page. Otherwise errors would appear in the same location user tried to sign-up.
I wonder what would be the best practice to implement what I want. I don't want to use ajax, just use the built-in mechanism of Rails.
Upvotes: 1
Views: 177
Reputation:
create a partial _form.html.erb under the authentication folder for example, then you can render this partial in any other view: <%= render partial: 'form' %> or <%= render partial: 'other_folder/form' %>
Upvotes: 0
Reputation: 5239
Your sign-up form should be a partial (i.e. signup/_form.html.erb). You can then render this in any other view:
If views are in same location:
<%= render partial: 'form' %>
If views are in other locations:
<%= render partial: 'other_location/form' %>
Upvotes: 1