Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 717 Bytes

README.rdoc

File metadata and controls

27 lines (18 loc) · 717 Bytes

Dateable

Dateable is a plugin to integrate features from Chronic into ActiveRecord

INSTALLATION

just throw dateable into your gemfile

gem 'dateable'

USAGE

Create a database migration with the fields #{field}, #{field}_string, and #{field}_specificity

create_table :calendar_entries do |table|
  table.datetime :appointment_date
  table.string   :appointment_date_string
  table.string   :appointment_date_specificity
end

Then, whenever you update #{field}_string, #{field} and #{field}_specificity get updated accordingly:

entry = CalendarEntry.create
entry.appointment_date_string = 'May 18th, 1985'
entry.save

$ entry.appointment_date.to_s
=> "1985-05-18 00:00:00 -0700"