This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Tue Mar 18 04:24:11 -0700 2008 | |
| |
MIT-LICENSE | Mon Oct 15 18:52:28 -0700 2007 | |
| |
README | Thu Jul 24 06:12:28 -0700 2008 | |
| |
Rakefile | Mon Oct 15 18:52:28 -0700 2007 | |
| |
init.rb | Tue Mar 18 20:00:11 -0700 2008 | |
| |
lib/ | Thu Jul 24 07:12:06 -0700 2008 | |
| |
tasks/ | Mon Oct 15 18:52:28 -0700 2007 | |
| |
test/ | Thu Jul 24 06:12:28 -0700 2008 |
README
ActsAsArchivable
================
ActsAsArchivable is a collection of methods that I found myself using quite a bit related
to models with time-stamped columns. Initial things were blog entries in regards to archives,
but I found that I was using these more and more in various ways throughout many models.
This library requires ActiveRecord.
class Entry < ActiveRecord::Base
acts_as_archivable :order => 'DESC'
has_many :comments, :dependent => :destroy
end
class Comment < ActiveRecord::Base
acts_as_archivable :on => :replied_on
belongs_to :entry
end
From here, you have quick access to records related to date.
Entry.by_date :year => 2007
Entry.by_date Date.today
Entry.by_date '5/1/2007'
Entry.oldest
Entry.newest
Entry.recent 2.weeks
Entry.recent 3.months
Entry.recent (3.months - 1.week)
Entry.between '5/10/2007', Date.today






