Reputation: 1060
I am new to ruby on rails I am having a view which have partial file in that partial file also i have to render same object but iam getting error .
Here are my code
app/view/customer/_form.html.erb
<%= simple_form_for(@customer) do |f| %>
<%= f.input :first_name, placeholder: 'First Name', label: 'Customer First Name' %>
<%= f.input :last_name, placeholder: 'Last name', label: 'Customer Last Name' %>
<%= f.input :email, placeholder: '[email protected]', label: 'Customer Email' %>
<%= render :partial=> other_fields,:f => f %>
<%end%>
app/views/customer/_other_fields.html.erb
<%= f.input :user_name, label: 'User Name' %>
<%= f.input :password, label: 'Password' %>
<%= f.input :password_confirmation, :required => true %>
I am getting error like
undefined local variable or method `f' for #
Upvotes: 0
Views: 2054
Reputation: 6029
Try this:
<%= render :partial=> other_fields, :object => @customer, :locals => {:f => f} %>
Upvotes: 0