Wednesday 15 January 2014

How does Rails implement the "date magic" mechanism on numbers? -


In railways (but not plain Ruby) can say things like:
  t = 

2.days t.inspect

= & gt; "2 days".

  t.to_i   

= & gt; 172800

This rail patch looks like Fixation, so it examines the string with the number of seconds and descriptions shown by the interval. How does it basically work? itemprop = "text">

Core extensions in ActiveSupport, such as string, object,

ActiveSupport is adding "days" for a number It is very basic:

  • 1 day 24 hours
  • 1 hour 60 minutes

No comments:

Post a Comment