Plugins - Getdate Column

StarAdd to favorites

This 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

Kyle Maxwell

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

  • Currently 5.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Model

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?