0

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

Kirti Thorat
  • 52,578
  • 9
  • 101
  • 108
Loenvpy
  • 899
  • 1
  • 10
  • 30

2 Answers2

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