# Storing form methods in a database

**URL:** <https://www.ruby-forum.com/t/storing-form-methods-in-a-database/49153>\
**Category:** Rails\
**Created:** [November 30, 2005, 7:28pm UTC](https://www.ruby-forum.com/t/storing-form-methods-in-a-database/49153 "2005-11-30T19:28:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JNewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbce88/32.png) [@JNewman](https://www.ruby-forum.com/u/JNewman)\
**Post date:** [November 30, 2005, 7:28pm UTC](https://www.ruby-forum.com/t/storing-form-methods-in-a-database/49153/1 "2005-11-30T19:28:40Z")

</div>

Hello all

I am very new to the ruby on rails. I am currently working on a survey  
project and I would like to store the survey questions with form  
elements in a database. I have been successful with adding the basic  
html code needed to display the question, however the rails tags \<% %\>  
are not being executed. Is there a way to force the execution of these  
tags when they are passed back from the database?

Thanks to all

Jeffrey Newman

Web D.

Mindshare Interactive Campaigns, L.L.C.

Ph 202.521.4435 / Fax 202.654.0839

[www.mindshare.net](http://www.mindshare.net) [http://www.mindshare.net/](http://www.mindshare.net/)

---

<div class="post-metadata">

**Author:** ![JNewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbce88/32.png) [@JNewman](https://www.ruby-forum.com/u/JNewman)\
**Post date:** [November 30, 2005, 11:03pm UTC](https://www.ruby-forum.com/t/storing-form-methods-in-a-database/49153/2 "2005-11-30T23:03:51Z")

</div>

You should really let people store ruby in a database, there are some  
nasty  
people out there that would exploit it. I would look at Liquid, from the creator of  
Typo.There is a \<a  
href+“http://leetsoft.com/rails/liquid-installation.mov”\>Moview This  
seems  
like a better solution.

Here To Help  
Joey\_\_

---

<div class="post-metadata">

**Author:** ![JNewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbce88/32.png) [@JNewman](https://www.ruby-forum.com/u/JNewman)\
**Post date:** [November 30, 2005, 11:03pm UTC](https://www.ruby-forum.com/t/storing-form-methods-in-a-database/49153/3 "2005-11-30T23:03:52Z")

</div>

> I am very new to the ruby on rails. I am currently working on a survey  
> project and I would like to store the survey questions with form elements in  
> a database. I have been successful with adding the basic html code needed  
> to display the question, however the rails tags \<% %\> are not being  
> executed. Is there a way to force the execution of these tags when they are  
> passed back from the database?

Show me the code that’s not working, and what you expect it to do and  
I’ll try to give you a hand with it.

You can reach me on IRC as srbaker most of the day (in PST), too.

-Steven

---

<div class="post-metadata">

**Author:** ![JNewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbce88/32.png) [@JNewman](https://www.ruby-forum.com/u/JNewman)\
**Post date:** [December 1, 2005, 10:07pm UTC](https://www.ruby-forum.com/t/storing-form-methods-in-a-database/49153/4 "2005-12-01T22:07:00Z")

</div>

Hi Steve

The problem is I used capture to create a instance variable for the  
form or survey question that is stored in the database when I display  
the variable \<%=@display\_question %\> Rails renders the html in the  
file but for some reason erb is not executing the ruby inside the  
delimiters i.e ruby variables that returned form the database or form  
methods used to short cut form fields in rails.

Have any ideas how I can get erb to correctly evaluate and execute  
the ruby code.

Thanks for your time

Jeff Newman

---

<div class="post-metadata">

**Author:** ![JNewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbce88/32.png) [@JNewman](https://www.ruby-forum.com/u/JNewman)\
**Post date:** [December 1, 2005, 10:10pm UTC](https://www.ruby-forum.com/t/storing-form-methods-in-a-database/49153/5 "2005-12-01T22:10:40Z")

</div>

jeffn05 wrote:

> Hi Steve
> 
> The problem is I used capture to create a instance variable for the  
> form or survey question that is stored in the database when I display  
> the variable \<%=@display\_question %\> Rails renders the html in the  
> file but for some reason erb is not executing the ruby inside the  
> delimiters i.e ruby variables that returned form the database or form  
> methods used to short cut form fields in rails.
> 
> Have any ideas how I can get erb to correctly evaluate and execute  
> the ruby code.
> 
> Thanks for your time
> 
> Jeff

You need to call a form of the “render” function on this text.

---

<div class="post-metadata">

**Author:** ![JNewman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbce88/32.png) [@JNewman](https://www.ruby-forum.com/u/JNewman)\
**Post date:** [December 2, 2005, 6:54pm UTC](https://www.ruby-forum.com/t/storing-form-methods-in-a-database/49153/6 "2005-12-02T18:54:20Z")

</div>

Thanks to All and Steve

I was able to use \<%= render :inline =\> @display\_question %\>. One  
not about doing this make sure the code your are posting in the  
database is 100% syntax correct otherwise the proram will throw an  
application error.
