Wednesday, 28 August 2013

How do I convert a sequence of words into an attribute?

How do I convert a sequence of words into an attribute?

I need to turn:
"First Name".some_method = "first_name"
I guess I could just use a regular expression, but wanted to know if there
was something better. I tried constantize, and humanize, and this is
pretty much the opposite of what I need to accomplish:
"first_name".humanize = "First name"

No comments:

Post a Comment