Pregunta

Hi I am new to Ruby on Rails and I am following Michael Hartl's book online. In Partials section of his book. The code he used to render partial was

<%= render 'layouts/stylesheets' %>

but I get this error.

I read the API and tried this

<%=render :partial => "/layouts/stylesheets" %>
but still can't figure this one out.

Thanks for all the help!

¿Fue útil?

Solución 2

I overlooked the filename. When I initially created the file, after the .erb extension, I accidentally put a space after.

Otros consejos

In your view, make sure you have the following structure:

- views
  - layouts
    - application.html.erb
    - _stylesheets.html.erb

Your code should be:

<%= render 'layouts/stylesheets' %>

If your main template is inside the layouts folder:

<%= render 'stylesheets' %>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top