Dynamic content inside a view - how to do


I have a program where customer can make different conditions (sales
promotions), I dont want to create view for each promotion for customers
to choose.

What I thought of is, if I could save a given promotion’s view’s (html)
code in a database and load it when user selects a give promotion

I can do it with plan HTML like,

<%= promotion.view_html%>

promotion is the db object
view_html is the column which has the html code of the view

But when there is ruby code like loop, etc… in my html view, although
i can save it in the database with out a problem, i cant view it

I tried to use yield, but still fails

below is my dynamic html view

<%= @promotons = Promotion.find(:all)%>
<% for promoton in @promotons %>

  • <%= promoton.name%>
  • <%end%>

    How can i do something like this, (I hope my question is clear :)) or Am
    i doing something wrong ?!

    thanks in advance