MultiFieldDateDescriptionThis is a Ruby on Rails plugin for use with tables/models that need to allow incomplete dates (e.g., just the year and month or just the month and day). Requires that the table have four fields: year, month, day, and full date. When the year, month, and day fields are present, the full date field is updated.
There are two ways to use this plugin:
acts_as_multi_field_date only allows one date_field per model. e.g.,
class Birth < ActiveRecord::Base
acts_as_multi_field_date :date_field => 'birth_date'
#assumes year, month, and day fields are 'year', 'month', and 'day' by default.
#can be changed:
# acts_as_multi_field_date :date_field => 'birth_date', :day_field => 'bday'
endmulti_field_date, on the other hand, allows multiple dates in a model, e.g.,
class Person < ActiveRecord::Base
multi_field_date :birth, :date_field => 'birth_date', :year_field => 'birth_year',
:month_field => 'birth_month', :day_field => 'birth_day'
multi_field_date :death, :date_field => 'death_date', :year_field => 'death_year',
:month_field => 'death_month', :day_field => 'death_day'
endIt also includes a helper method for displaying a partially completed date, and some helpers for generating arrays for HTML select menus. Includes rather extensive unit test coverage (requires SQLite3).
Installationscript/plugin install http://rails-multifielddate-plugin.googlecode.com/svn/plugins/multi_field_dateThen run rake doc:plugins to generate RDoc documentation.
See also: README
These details are provided for information only. No information here is legal advice and should not be used as such.