Here's the call in the application.html.erb
file:
<%= render :partial => 'tasks/_new' %>
Here's the partial being rendered (_new.html.erb
):
<% form_for @task do |f| -%>
<%= f.text_field :body %>
<%= submit_tag "Submit" %>
<% end -%>
Here's the method in the 'tasks' controller:
def new
@task = Task.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @task }
end
end
Here's the error message I keep getting:
Missing template tasks/__new.erb in view path app/views
And it says the error is in this line:
<%= link_to "tasks", tasks_path %> <%= render :partial => 'tasks/_new' %>
The file is in the right directory. The weird thing is that there's an
extra _
in the file name, in the error. When I give in and rename the
partial to __new.erb
, here's the error I get:
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
And it says the error is in this line:
<% form_for @task do |f| -%>
I had also tried without the _
in the code, as Petros suggested, but it returns the same error as above, Called id for nil…
.
What's going on?