I develop a website using Rails 4. In this website there is a company form which should be located also in the job form. I wonder what would be the best practice to render this form to a different page. The companies and the jobs are created via scaffold so every form has their route
Asked
Active
Viewed 58 times
0
-
please paste your model relationship and what you want to achieve – Anil Maurya Feb 22 '14 at 20:53
-
Don't use scaffolding. http://stackoverflow.com/questions/6735468/why-do-ruby-on-rails-professionals-not-use-scaffolding – Rafa Paez Feb 22 '14 at 20:54
2 Answers
1
Create a partial
for the common form eg: _common_form.html.erb
.
Then in your company and job views, you can use the same form by calling the render method.
<%= render 'common_form'%>

Kirti Thorat
- 52,578
- 9
- 101
- 108
0
You can put the form to the separate folder, shared for example. And then render the form from the company/job pages with params:
<%= render :partial => 'shared/company', :locals => { :company => @company } %>

alex
- 3,682
- 3
- 21
- 22