hello guys i have a big problem and i don''t know how to solve it -.- i have a data base. the models name is Blafoo if i go to console i create a new entry with tst = Blafoo.new(:d1 => true) with Blafoo.d1 i can now see the calue of d1 lets take a variable var = "d1" how can i get it working, that i can interpret var as d1 so tst.(var) ?? gives me the value of tst.d1? thanks for help.. im awaiting it so much! basti -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
On Mon, 02 Jul 2012 21:21:25 +0200 "Sebastian H." <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> hello guys > > i have a big problem and i don''t know how to solve it -.- > > i have a data base. the models name is Blafoo > > if i go to console i create a new entry with tst = Blafoo.new(:d1 => > true) > > with Blafoo.d1 i can now see the calue of d1 > > lets take a variable var = "d1" > > how can i get it working, that i can interpret var as d1 > > so tst.(var) ?? gives me the value of tst.d1? > > thanks for help.. > > im awaiting it so much! > > basti >Basically `test.d1` in this case is just a message. So you can call it like: `test.send :d1`, or in your situation: `test.send var.to_sym` -- Sincerely yours, Aleksey V. Zapparov A.K.A. ixti FSF Member #7118 Mobile Phone: +34 677 990 688 Homepage: http://www.ixti.net JID: zapparov-962d5TIgE1qHXe+LvDLADg@public.gmane.org *Origin: Happy Hacking!
oh yeah ! thank you very much! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
how can i change the value of d1 in this way ? something like tst.send a[0].to_sym = "hello" ?? Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
On 3 July 2012 09:23, Sebastian H. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> how can i change the value of d1 in this way ?Did you not just ask that 1 hour ago? There is no point posting the same question twice, it will just annoy people. Colin> > something like > > tst.send a[0].to_sym = "hello" ?? > > Thanks > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.