Вопрос

For example, I want to do something like this:

= render 'header_splash'
  #about.section
    h2 You've reached our home page.

... where header_splash.slim looks like this:

#header_splash
  h1 Here's the splash image and the nav elements

I want the #about section to be rendered inside the header_splash div but it's rendering outside of it, even though it's nested in the code.

Is it at all possible to nest like this?

Это было полезно?

Решение

You can't. If you want something rendered in a partial, you need to render it in the partial. You can pass in additional variables if necessary:

= render partial: 'header_splash', locals: { header_text: "you've reached ..." }

The locals hash will be available in your partial as variables:

h2= header_text
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top