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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Cool! It works like a charm :-). Is there any thing similar in rails, rather than ruby? On Jan 23, 6:59 pm, Thorsten Mueller <rails-mailing-l...@andreas- s.net> wrote:> 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 > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
@var1 = "Hello"
@var2 = "World #{@var1}"
On Jan 24, 2008 4:54 PM, mohit_ranka
<mohitranka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Cool! It works like a charm :-).
>
> Is there any thing similar in rails, rather than ruby?
>
> On Jan 23, 6:59 pm, Thorsten Mueller <rails-mailing-l...@andreas-
> s.net> wrote:
> > 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
> > --
> > Posted viahttp://www.ruby-forum.com/.
> >
>
--
Ryan Bigg
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---