Convert to method call?

Hi all,

I would like to store a method call in a database, yet once saved I
don’t know how to convert it from a string back to a method call.


distance_of_time_in_words(order.created_at, order.created_at +

The value of order.due_date “10.weeks”, but could be “20.days”,
“100.months”, etc.

Just wondering if there’s a way to convert a
string “10.weeks”
to a method

Thanks for your help!


found it. “the google” said:

I split the 10 and weeks into two separate columns, due_in and due_from
(couldn’t thing of what to call em).

This seems to work just fine.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs