Rails - Wat?! moments

I was working on a Rails project, and as is normally the case, when in doubt, I open up the rails console and try out stuff I'm not sure about.

The Wat?!!? Moment

Try this in your rails console:

1.day.seconds and you will get back 86400 seconds. That is right.

Now try 1.day.minutes, you would assume to get 1440 minutes but you get the answer in seconds.
Well, thats not the only thing wrong, you get wrong number of seconds too.
It returns 5184000 seconds.



Similarly, if you try the following :


You'd be shocked.

If you haven't tried, here's what you get:

The Problem

The problem is in ActiveSupport gem, being more specific,

It falls apart the moment you start chaining these methods, like shown above.

Lets fix this

Looking for interested folks to pair with to fix this issue.
Check out pair time availability here.

Murtuza Kutub

Read more posts by this author.

Chennai, India

Subscribe to Murtuza's Blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!