AirWick219
AirWick219

Reputation: 944

Rails same render partial as html string ?

So I come across with a problem where I would like to save a partial as an html string and render another partial with that string but I keep getting a double render error

def fruits 
  fruits = Fruits.all 
  market_html = "#{render partial: 'market', locals: {fruits: fruits}}"  
  render partial: 'super_market', locals {market_html: market_html}
end 

Upvotes: 0

Views: 234

Answers (1)

jrochkind
jrochkind

Reputation: 23317

Do you want render_to_string?

market_html = render_to_string partial: 'market', locals: {fruits: fruits}

Upvotes: 2

Related Questions