Skip to content

Rails plugin that allows assignment of attribute accessor that behave like time objects with multiparameter support

License

Notifications You must be signed in to change notification settings

gabeodess/Time-Accessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Rails plugin that allows assignment of attribute accessor that behave like time objects with multiparameter support

Resources

License

Stars

Watchers

Forks

Packages

No packages published