Alvaro Lourenço
Alvaro Lourenço

Reputation: 1341

Haml nesting with rendered partial in Rails

Consider a partial.haml like this:

- haml_tag :body, {:id => @instance_var}

What I'm trying to do is to nest haml content under a rendered partial. Something like:

= render 'partial_file' do
    %h1 My test
    %p Trying to nest under a partial output.

But this is causing view errors like:

'nil' is not an ActiveModel-compatible object that returns a valid partial path.

Is there any similar solution to accomplish this?

Upvotes: 2

Views: 704

Answers (1)

Fiona Hopkins
Fiona Hopkins

Reputation: 1976

I solved this per the recommendation in Rails: How to render repetitive form block? by specifying the render as :layout:

= render :layout => 'partial_file' do
    %h1 My test

Upvotes: 3

Related Questions