0.0
No commit activity in last 3 years
No release in over 3 years
Adds a time_accessor method to ActiveRecord::Base to create time attributes that accept multiparameter attributes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

TimeAccessor¶ ↑

Time Accessor is a Rails plugin that adds a time_accessor method to ActiveRecord::Base. The method helps to setup attribute accessors that behave like Time objects and can be set using multiparameters.

Install¶ ↑

Add it to your Gemfile:

gem 'time_accessor'

Usage¶ ↑

Use the time_accessor method in your model:

class User < ActiveRecord::Base
  time_accessor :time
end

Then set your ‘time’ attribute with multiparameters:

user = User.new({"time(1i)" => 2012, "time(2i)" => 01, "time(3i)" => 21})
user.time # => 2012-01-21 00:00:00 UTC

License¶ ↑

This project rocks and uses MIT-LICENSE.