Hi All,
I have a string variable that contains other ruby
variables. I intend to render the string variable and replace the
other ruby variables in it with their values.Is it possible?
To clarify my question, here is the same :-
@ruby_variable = “Some value in the variable”
@variable_to_be_rendered = “Some text @ruby_variable”
After rendering(if thats possible, or some other function), I would
get the value
“Some text Some value in the variable”
Regards,
Mohit
yes, you can use erb for that
http://www.ruby-doc.org/core/classes/ERB.html
@variable_to_be_rendered = “Some text @ruby_variable”
would have to look like:
@variable_to_be_rendered = “Some text <%= @ruby_variable %>”
to do that
Cool! It works like a charm :-).
Is there any thing similar in rails, rather than ruby?
On Jan 23, 6:59 pm, Thorsten M. <rails-mailing-l…@andreas-
@var1 = “Hello”
@var2 = “World #{@var1}”
On Jan 24, 2008 4:54 PM, mohit_ranka [email protected] wrote:
Posted viahttp://www.ruby-forum.com/.
–
Ryan B.
Feel free to add me to MSN and/or GTalk as this email.