Re: [Rails] variable symbol

2012-07-03 Thread Colin Law
On 3 July 2012 08:20, Sebastian H. wrote: > Hi > > i hava a database tst with attributes d1 and d2 > > in an array a=["d1","d2"] > > to get to the value of tst.d1 i can use > > tst.send a[0].to_sym > > how can i change the value of d1 in this way ? > > something like > > tst.send a[0].to_sym = "he

Re: [Rails] variable symbol

2012-07-03 Thread Aleksey V Zapparov
On Tue, 03 Jul 2012 09:20:11 +0200 "Sebastian H." wrote: > to get to the value of tst.d1 i can use > tst.send a[0].to_sym > > how can i change the value of d1 in this way ? > something like > tst.send a[0].to_sym = "hello" ?? Almost, but, you myst to send `:d1=` symbol, so correct call is: tst

[Rails] variable symbol

2012-07-03 Thread Sebastian H.
Hi i hava a database tst with attributes d1 and d2 in an array a=["d1","d2"] to get to the value of tst.d1 i can use tst.send a[0].to_sym 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/. -- Y