If I use <%= parent.name %> and or <%= parent.child.name %> then i get the correct record. BUT if say <% nameholder = "parent.child.name" %> <%= nameholder %> it just prints parent.child.name. How do I get ruby to recognize nameholder as object? Thanks, James -- Posted via http://www.ruby-forum.com/.
Don''t quote parent.child.name. <% nameholder = parent.child.name %> -- Posted via http://www.ruby-forum.com/.
Adam Bloom wrote:> Don''t quote parent.child.name. > > <% nameholder = parent.child.name %>Thanks for the quick response. <% nameholder = "parent.child.name" %> The quotes are actually from some other logic where I am parsing a string in order to create the correct parent.child.name... in other words Im creating it dynamically but how do I change it back to a command from a string. Obviously Im a newbie, but I appreciate your help/patience. James -- Posted via http://www.ruby-forum.com/.
I don''t think that''s possible. However, I KNOW it''s possible to dynamically create code. My suggestion is you post your code block that creates that string, and wait for someone with more Ruby knowledge than I to help you convert it into working Ruby. -Adam -- Posted via http://www.ruby-forum.com/.
You''re trying to execute a method named by the result of parent.child.name? You could try.. <% nameholder = eval(parent.child.name.to_s) %> -henry On 5/4/06, james <jrutherford@gpb.org> wrote:> Adam Bloom wrote: > > Don''t quote parent.child.name. > > > > <% nameholder = parent.child.name %> > > > Thanks for the quick response. > > <% nameholder = "parent.child.name" %> The quotes are actually from some > other logic where I am parsing a string in order to create the correct > parent.child.name... in other words Im creating it dynamically but how > do I change it back to a command from a string. > > Obviously Im a newbie, but I appreciate your help/patience. > > James > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Henry Turner wrote:> You''re trying to execute a method named by the result of > parent.child.name? > > You could try.. > > <% nameholder = eval(parent.child.name.to_s) %> > > -henryI love you. Thanks That was it! -- Posted via http://www.ruby-forum.com/.