Reporting ActiveSupport::Duration in concise human readable formats
by Syed Aslam · 2 min read
Convert ActiveSupport::Duration objects to concise human readable formats like '2h 30m 45s' with locale support.
3 posts in total
by Syed Aslam · 2 min read
Convert ActiveSupport::Duration objects to concise human readable formats like '2h 30m 45s' with locale support.
by Syed Aslam · 2 min read
Easy way to set a background from a selected number of images in Rails. You can set a background image purely through CSS thanks to the 'background-size' property in CSS3. Using the `html` element is better than `body` as it's always at least the height of the browser window. You set a fixed and centered background on it, then adjust it's size using `background-size` set to the cover keyword.
by Syed Aslam · 1 min read
It's very common to want to highlight the current link within a navigation list for the current action being performed. In Rails, if you are using Ajax, then this is easy, handle the onclick event to highlight the current link.