mongo_mapper-readonly_attributes

Adds a readonly_attributes class method to mongo_mapper models.

Add gem to Gemfile:

gem "mongo_mapper-readonly_attributes", :require => "mongo_mapper/readonly_attributes"

To use include in your model:

plugin MongoMapper::ReadonlyAttributes

Now you can use:

attr_readonly  :foo

Or to add it globally, create an initialization file with:

MongoMapper::Document.plugin(MongoMapper::ReadonlyAttributes)
MongoMapper::EmbeddedDocument.plugin(MongoMapper::ReadonlyAttributes)

Copyright © 2013 Ohad Peres. See LICENSE.txt for further details.