Reputation: 3341
How can I display the output in html? Here is my sample code in ruby:
m = ["a","b", "c"]
m.each do |i|
@html = "<p>"+#{i}+"</p>"
end
I have a separate view file which reads the @html string:
<%= @html.html_safe</p>
My question is, how do i invoke the view file?
Upvotes: 0
Views: 550
Reputation: 4504
First fix typo in your code
@html = "<p>"+#{i}+"</p>"
should read
@html = "<p>#{i}</p>"
Now coming to the point just pass this at the end of your action
erb :<name-of-your-template>
this assumes you are having your erb templates under views directory
Upvotes: 3