Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Include erb in a database record
3 Posts
Include erb in a database record

I have a controller, blocks, that I would like to use to add sibebar block content using a controller created by scaffolding. I would like the blocks to be able to display dynamic content, like today's date. If I add the code [code][/code] to the content of a block record, that is exactly what gets displayed in the view. It does not get interpreted as erb.

Is there a way to output the record differently so the erb is interpreted?

You can use "render":http://api.rubyonrails.com/classes/ActionController/Base.html#M000512:

# Renders "hello, hello, hello, again" render :inline => ""

Thank you, that is exactly what I was looking for.

3 Posts
Login to add your message