I have several shared parts that I can display from any controller, but I have few problems displaying partial data from another controller. I want to be able to add notes to my contacts.
In my contacts /show.html.erb I have
<% render :partial => "notes/form", :note => Note.new %>
In my notes /_form.html.erb I have
<%= form_for @note do |f| %>
<%= render 'shared/error_messages', :object => f.object %>
<p>
<%= f.label :content %><br />
<%= f.text_field :content %>
</p>
<p>
<%= f.label :contact_id %><br />
<%= f.number_field :contact_id %>
</p>
<p><%= f.submit %></p>
<% end %>
However, I get the error message:
Display / Applications / Rails / apps / saas31 / app / views / notes / _form.html.erb, where line # 1 is raised:
undefined method `` model_name '' for NilClass: Class
Extracted source (around line # 1):
1: <% = form_for @note do | f | %> 2: <% = render 'shared / error_messages' ,: object => f.object%>
, , , - , . - ?