Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails message: ActionView::MissingTemplate

I am getting an error that I cannot figure out:

ActionView::MissingTemplate (Missing template cluster/delete_stuff.erb in view path app/views)
<...snip trace...>
Rendering rescues/layout (internal_server_error)

I am "enhancing" others code and am following the convention they set up, where they have have code like:

<%= render :partial => "other_stuff" %>

And a file named _other_stuff.html.erb and it all works, but when I copy these little snippets, I get the above error. Any ideas? Something is going on here that I need to figure out.

like image 941
rtfminc Avatar asked Jun 10 '10 23:06

rtfminc


2 Answers

Turns out that I did not have a

render :something

in my controller method, so I guess Rails figured that there must be a "delete_stuff.erb" somewhere to know what to do. Added a render and the error message goes away.

like image 147
rtfminc Avatar answered Sep 30 '22 03:09

rtfminc


ActionView will look for templates/partials in the current controllers view folder, unless its view path has been changed in the controller—you can prepend and append different view paths for it to try and match first. Since you mention partials specifically, have a look at the documentation on partials.

Do you have a _delete_stuff.html.erb file in your views/cluster directory? If not, where is the _delete_stuff.html.erb partial? If it's not in the same directory, you will have to call render :partial => 'other_directory/delete_stuff' for your partial to appear.

like image 22
theIV Avatar answered Sep 30 '22 01:09

theIV