Rendering a variable with erb.
Posted
by TZer0
on Stack Overflow
See other posts from Stack Overflow
or by TZer0
Published on 2010-05-07T02:13:11Z
Indexed on
2010/05/07
2:18 UTC
Read the original article
Hit count: 325
I've got the following problem: I have rhtml (html minced together with ruby inside <% %> and <%= %> tags) stored in a database which I want to render. The information is acquired through a query. I need to be able to evaluate the information I get from the database as though as it was normal content inside the .erb-file. What I currently have:
<% @mymods.each do |mod| %>
<%= render_text(mod["html"])%>
<% end %>
Where mod["html"] is the variable containing the rhtml-code and @mymods an array of objects from the query. I have currently no idea what function I should use (render_text does, of course, not work).
Help is greatly appreciated.
/TZer0
© Stack Overflow or respective owner