cementhorses / schedulable
schedulable
Public"Schedulability" to your models, as simple as 1, 2, `schedulable`
6 filesupdated Jun 18, 2026
files6Download
./libJun 16, 2026./testJun 16, 2026init.rbJun 16, 2026MIT-LICENSEJun 16, 2026RakefileJun 16, 2026README.markdownJun 18, 2026README
Schedulable
"Schedulability" to your models, as simple as 1, 2,
schedulable
Just install.
$ script/plugin install git://github.com/cementhorses/schedulable.git
Options
Calling schedulable automatically hooks a few methods to a published_at
column:
scheduled?(trueif the item is scheduled to be published but isn't yet)published?(trueif the item is published)
The real power is when expiration is a question
schedulable :end => :archived_at
or
schedulable :published_at, :archived_at
does a little more:
scheduled? :archived_at(trueifarchived_atis set in the future)archived?(trueif the item has been archived)
with a note:
published?returnsfalsewhenarchived?returnstrue.
It's all semantic sugar:
schedulable :activated_at, :terminated_at, :end_required => true
therefore creates:
activated?terminated?
And that last option? It just adds a validation requiring the :end to be set
if the :start is.
We have your other validations taken care of, too. We're just more comfortable with things when they're chronological.
Rails 2.1 Is Extra Sweet
named_scope support means a few extra methods.
class NewsItem < ActiveRecord::Base
schedulable :published_at, :archived_at
end
Now you can scope it out:
NewsItem.scheduledreturns news items scheduled to be publishedNewsItem.publishedreturns published news itemsNewsItem.archivedreturns archived news items
Copyright (c) 2008 Cement Horses, released under the MIT license.