Acts As Lockdown
A Rails plugin that addresses the need for certain ActiveRecord attributes to be unwritable when a record has entered a certain state. Take for example a product that begins in a “pending” state, and later enters a “published” state. From that point on, you require that the price and description must not be changed.
The plugin assumes that you have a state machine in place that and your object will respond to a query on the state you specify eg self.published? It works by overwriting the setters. The getters remain unchanged.
Usage
Include acts_as_lockdown, then do a lockdown specifying the state, and any fields that you want frozen from further writing.
class Product
Download
Get it here: http://github.com/gordonbisnor/acts_as_lockdown
I am available for Ruby on Rails consulting work – get in touch to learn more.