1

In Rails/HAML I have the following partial:

.blur
  .blur.underground= text
  .blur.foreground
    = yield

It draws blurred out text in the underground and (should) draw the yielded content in the foreground. Unfortunately, when I call

= render 'partial name' do
  %h1 xyz

the '%h1 xyz' is not inserted in my partial.

Am I doing something wrong or is there an alternative way to achieve this?

alxppp
  • 107
  • 1
  • 10

1 Answers1

3

This worked for me

= render layout: 'partial name' do
  %h1 xyz

(note the 'layout') and then

.blur
  .blur.underground= text
  .blur.foreground
    = yield

produced

div class="blur">
  <div class="blur underground">text</div>
  <div class="blur foreground">
    <h1>xyz</h1>
  </div>
</div>
JTG
  • 8,587
  • 6
  • 31
  • 38
  • 1
    Thanks, this works beautifully! Note: if you also want to pass local variables, you need the locals symbol: = render layout: 'partial name', locals: {text: 'xyz'} – alxppp Nov 05 '14 at 19:13