0

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 

1 Answer 1

2

Do you want render_to_string?

market_html = render_to_string partial: 'market', locals: {fruits: fruits}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.