public
Description: Rails plugin to add named timestamps to ActiveRecord models.
Homepage:
Clone URL: git://github.com/seamusabshere/has_timestamps.git
name age message
file MIT-LICENSE Fri Dec 12 06:21:42 -0800 2008 Initial import. [Seamus Abshere]
file README Tue Feb 10 16:38:29 -0800 2009 Stop using an exclamation point because it does... [seamusabshere]
file Rakefile Thu May 14 18:07:40 -0700 2009 include examples [seamusabshere]
file VERSION.yml Fri May 15 11:23:39 -0700 2009 Version bump to 1.5.6 [seamusabshere]
directory examples/ Fri May 15 11:23:34 -0700 2009 finally fixed (maybe?) [seamusabshere]
file has_timestamps.gemspec Fri May 15 11:23:42 -0700 2009 Regenerated gemspec for version 1.5.6 [seamusabshere]
directory lib/ Fri May 15 11:23:34 -0700 2009 finally fixed (maybe?) [seamusabshere]
directory test/ Tue Feb 10 16:38:29 -0800 2009 Stop using an exclamation point because it does... [seamusabshere]
README
HasTimestamps
=================

Lets you timestamp models without adding a lot of timestamp fields to your tables.

Note: it **doesn't** save objects automatically, so you have to run a "user.save" (etc.) when you're done timestamping.

Installation
============

You should be able to run this as a plugin or as a gem.

For environment.rb:

config.gem 'seamusabshere-has_timestamps', :lib => 'has_timestamps', :source => 'http://gems.github.com'

Then be sure to:

sudo rake gems:install

Finally in a migration:

Timestamp.create_table (and Timestamp.drop_table for the down migration)

Example
=======

class User < ActiveRecord::Base
  has_timestamps
end

>> user.timestamps
=> []
>> user.timestamp(:greeted)
=> Wed Dec 10 15:11:52 -0500 2008
>> user.timestamps
=> [#<Timestamp id: nil, timestampable_id: 14, timestampable_type: "User", key: "greeted", stamped_at: "2008-12-10 
15:11:52", created_at: nil, updated_at: nil>]
>> user.save
=> true
>> user.timestamped?(:greeted)
=> true
>> user.timestamps[:greeted]
=> Wed Dec 10 15:11:52 -0500 2008
>> user.timestamped?(:saluted)
=> false

Credits
=======

Thanks to Fingertips for inspiration.

Copyright (c) 2009 Seamus Abshere, released under the MIT license.