btw you can do it using "eval" like eval("1.month")

On Friday, 20 September 2013 03:30:16 UTC-4, Fai Wong wrote:
>
> If I store 1.month as a string in the database, how do I convert "1.month" 
> into 1.month?
>
> This way I can use the "1.month" value stored in database to perform the 
> following calculation.
>
> Time.now + 1.month 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f1f52892-acd5-47d6-8d50-7686bfb39841%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to