Plugins - Getdate Column
Add to favoritesThis plugin is designed to make the accessor methods of a datetime column accept and return string representations of the date (e.g. "today", "10 days from now", "1/2/06 10pm").
Please note that this plugin doesn’t work on Windows.
Usage
class Event < ActiveRecord::Base
getdate_column :start
getdate_column :finish, :date_format => :short
end
>> e = Event.new
=> #
>> e.start = "tomorrow"
=> "tomorrow"
>> e.start
=> "July 28, 2006 09:12"
>> e.start(:raw)
=> Fri Jul 28 09:12:39 PDT 2006
>> e.start(:raw).class
=> Time
Installation
This plugin requires the ruby-getdate binding from tua.ch, which is packaged with this plugin for your convenience. To install it:
cd vendor/plugins/getdate_column/binding ruby extconf.rb make sudo make install
