vendredi 20 février 2015

Obtaining a Ruby on Rails variable from a String?

I would like to ask if it is possible to create a new ROR variable from a string.

For example, I would like to have something like below:


member = Member.find_by_id 1 user = "member"


I want #{user} to return me the actual member variable

and also #{user}.name to return me the same result as member.name


Aucun commentaire:

Enregistrer un commentaire