Ruby on Rails Tuesday, July 3, 2012

On 3 July 2012 08:20, Sebastian H. <lists@ruby-forum.com> 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 = "hello" ??

I would be interested to know why you need to do this. In my
experience it is very unusual to have a requirement like this, often
there is a better way of satisfying the underlying requirement.

Colin

>
> 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@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> 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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.

No comments:

Post a Comment