[Rails] [ANN] getdate_column

Kyle Maxwell kyle at kylemaxwell.com
Thu Jul 27 16:25:55 GMT 2006


Plugin location:
http://svn.kylemaxwell.com/getdate_column/

** Won't work on Windows **

OVERVIEW
===================

Getdate_column 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").  I personally find date
controls on the web to be clumsy, and would prefer to just have a text
field where I can enter a reasonable representation of a date.

USAGE
===================
class Event < ActiveRecord::Base
  getdate_column :start
  getdate_column :finish, :date_format => :short
end

>> e = Event.new
=> #<Event:0x252e240 ... >
>> 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

INSTALL
===================

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


More information about the Rails mailing list