This repository has been archived by the owner on May 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Simple plugin that makes it easier to deal with timespan fields stored in seconds, by providing *_hours helper methods
License
adonaldson/acts_as_hourable
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ActsAsHourable ============== When durations are stored as seconds, it's useful sometimes to deal with the values in hours. For each configured method that returns a number, an extra method will be added that returns the same value, but in hours. And yes, the name is bad. Oh, and only a handful of tests so far. Example ======= class Task < ActiveRecord::Base acts_as_hourable :duration # # Creates a method Task#duration_hours(decimal_places = 1) # or... acts_as_hourable :estimated_duration, :actual_duration or... acts_as_hourable :duration, :decimal_places => 8, :suffix => "_turnip" # # Creates a method Task#duration_turnip(decimal_places = 8) # end Additionally, theres now a helper: ActsAsHourable::round_to_decimal_place(value, decimal_places) if you particularly like the functionality. Found on github: http://github.com/dies-el/acts_as_hourable/tree/master Copyright (c) 2008 Andrew 'dies-el' Donaldson (http://dies-el.co.uk), released under the MIT license
About
Simple plugin that makes it easier to deal with timespan fields stored in seconds, by providing *_hours helper methods
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published