Sha256: b4a0d587bdd1375c1801bbcb76240a0caebfb0ca84b6d7b4c9390ce6d1ef6954
Contents?: true
Size: 1.9 KB
Versions: 5
Compression:
Stored size: 1.9 KB
Contents
= publishable Rails engine for encapsulating the concept of a publishable resource. Included are: * acts_as_publishable extension for models * controller to handle tha publishing and unpublishing of resources complete with routes * helpers for urls and links == Instalation Specify it in your Rails config. config.gem 'aguids-publishable', :lib => 'publishable', :source => 'http://gems.github.com' Then install it. rake gems:install == Usage The first step is to declare a model that acts-as-publishable: class ListItem < ActiveRecord::Base acts_as_publishable end === Options The default initial state for publishable models is unpublished. To change that just pass the initial state option: acts_as_publishable :initial_state => :published The status column is the default for storing publish status. If you would like to change jus pass the column option: acts_as_publishable :column => :my_fancy_column === Controller The publications controller has two actions mapped to it: create and destroy :resource/:id/publish #create :resource/:id/unpublish #destroy Remember these are restful, so only posts to create and deletes to destroy are accepted. If you would like to override the flash messages just define the appropriate translations: flash: publications: create: notice: 'New publish message.' destroy: notice: 'New unpublish message.' === Helpers Route helpers are available publish_path(post) # post/post_id/publish Apart from the route helpers we have the following link helpers: publication_link(resource) # Either a link to publish or unpublish publication_links(resource) # List with Publish | Unpublish options To use the helpers just drop the helper call on the applications controller helper :publications == Copyright Copyright (c) 2009 Felipe Doria. See LICENSE for details.
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
aguids-publishable-0.1.2 | README.rdoc |
aguids-publishable-0.1.3 | README.rdoc |
aguids-publishable-0.1.4 | README.rdoc |
aguids-publishable-0.1.5 | README.rdoc |
aguids-publishable-0.1.6 | README.rdoc |