Forum: Ruby on Rails Storing form methods in a database

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
76723e0e2b435ccc0b0aa59190a32311?d=identicon&s=25 JNewman (Guest)
on 2005-11-30 19:28
(Received via mailing list)
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 Developer

Mindshare Interactive Campaigns, L.L.C.

Ph 202.521.4435 / Fax 202.654.0839

www.mindshare.net <http://www.mindshare.net/>
6dab365a82517fb694650a57ee88e4a4?d=identicon&s=25 cardologist (Guest)
on 2005-11-30 23:03
(Received via mailing list)
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 <a
href="http://home.leetsoft.com/liquid">Liquid</a>, from the creator of
Typo.There is a <a
href+"http://leetsoft.com/rails/liquid-installation.mov"... This
seems
like a better solution.

Here To Help
Joey__
741a3b49ae2937c3d62e45d1699b674a?d=identicon&s=25 srbaker (Guest)
on 2005-11-30 23:03
(Received via mailing list)
> 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
60d6a9aa0394aaacc4539a2963967280?d=identicon&s=25 jeffn05 (Guest)
on 2005-12-01 22:07
(Received via mailing list)
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
2be6e0470d7c61e77c5ec74bfe5e8eea?d=identicon&s=25 Jeff (Guest)
on 2005-12-01 22:10
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.
60d6a9aa0394aaacc4539a2963967280?d=identicon&s=25 jeffn05 (Guest)
on 2005-12-02 18:54
(Received via mailing list)
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.
This topic is locked and can not be replied to.