No commit activity in last 3 years
No release in over 3 years
Rails gem that adds functionality to make Active Record models publishable
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.0
 Project Readme

acts_as_publishable¶ ↑

Rails gem for making ActiveRecord models publishable.

Installation¶ ↑

gem install acts_as_publishable

Usage¶ ↑

Make a model publishable:

class MyModel < ActiveRecord::Base acts_as_publishable … end

Create a migration that adds the needed columns to the my_models table:

script/generate migration AddPublishableColumnsToMyModel publish_now:boolean published_from:datetime published_to:datetime

Now you can ask if an instance of MyModel is published:

my_model = MyModel.first my_model.published? => true

The published? method returns true if my_model either has publish_now set to true or published_from is set in the past and published_to is set in the future.

And you can also find instances of MyModel that are published:

MyModel.find_published

This finds all instances where published? returns true.

The find_published finder method accepts any of the normal options as the default find method accepts.

TODO¶ ↑

  • Option for configuring whether publish_now should be OR’d or AND’d with the published_from and published_to columns

  • Add publish! and unpublish! instance methods

  • Update README to reflect functionality (config options, validation and the scope)

License¶ ↑

acts_as_publishable is distributed under the Simplified BSD License, copyright © 2010 Rasmus Bang Grouleff