Hi David,
On 10 Apr 2011, at 04:37, David Kahn wrote:
> Is there a different way to do such an eval? In actuality what I am doing
> with this phrase is to assign hash params to the attributes of a class:
>
> eval("background_process_status.#{key.to_s}='#{value}'")
Assuming you have attribute writers defined for your attributes:
background_process_status.send("#{key}=", value)
would be better, I think.
Regards,
Tony.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.