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?
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.
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.
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.
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.
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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.