mercredi 14 octobre 2015

Rendering partials in haml and passing variable to it

I'm trying to render my partials by iterating through variables and then pass specific variable to the partial but it doesn't see this variable.

Here I'm rendering it

(dogs.html.haml)

- dogs.each do |dog|
    .dog
      = render 'dog', :locals => { :dog => dog }

And then I want variable dog to be visible in my partial

(_dog.html.haml)

.title
  = dog.name

But it's not visible

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire