How do you use a partial layout template?

I have a partial that I would like to use in the layout, but when I load the page, it will look in another folder for the partial.

So, for my layout I have.

%html
  %head
%body
  .content
    = yield
  .footer
  = render :partial => 'tracking'

And in my layouts folder, I have a partial file "app / views / layouts / _tracking.html.haml" that I would like to use in the layout for all pages. But when I load the page, it will give me an error saying that it cannot find the template "products / _tracking.erb"

+3
source share
2 answers

just use

= render :partial => '/layouts/tracking'
+7
source

I think you just give it the full path to it, for example

<%= render "shared/menu" %>

ref: 3.4.1 : http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials

+2

Source: https://habr.com/ru/post/1718410/


All Articles