github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

seamusabshere / has_timestamps

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 3
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (7)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (7)
    • v1.5.6
    • v1.5.5
    • v1.5.4
    • v1.5.3
    • v1.5.2
    • v1.5.0
    • v1.4.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Rails plugin to add named timestamps to ActiveRecord models. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Regenerated gemspec for version 1.5.6 
seamusabshere (author)
Fri May 15 11:23:42 -0700 2009
commit  4959f1d001ee4b20ca6379e575c7fbe2cca22161
tree    28d373a6f5af118fe09c8d8760607398f8319e86
parent  c7a49c827a0ed7696203ceb9bf95cc64eb95bc6b
has_timestamps /
name age
history
message
file MIT-LICENSE Loading commit data...
file README
file Rakefile
file VERSION.yml
directory examples/
file has_timestamps.gemspec
directory lib/
directory test/
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.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server