Has Timestamps plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install git://github.com/seamusabshere/has_timestamps.git
Example
=======
class CreateTimestamps < ActiveRecord::Migration def self.up create_table(:timestamps) do |t| t.integer :timestampable_id t.string :timestampable_type t.string :key t.datetime :stamped_at t.timestamps end end def self.down drop_table(:timestamps) end end
then...
class User < ActiveRecord::Base has_timestamps end
>> user.timestamps => [] >> user.timestamp!(:hailed) => Wed Dec 10 15:11:52 -0500 2008 >> user.timestamps => [#] >> user.timestamped?(:hailed) => true >> user.save => true >> user.timestamped?(:saluted) => false >> user.timestamp!(:saluted) => Wed Dec 10 15:12:28 -0500 2008 >> user.timestamped?(:saluted) => true >> user.timestamps[:saluted] => Wed Dec 10 15:12:28 -0500 2008 >> user.timestamps[:hailed] => Wed Dec 10 15:11:52 -0500 2008
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago


