readonly_fields

A simple rails plugin to make fields readonly. This means that it will add an error to fields when they are changed.

Installation

./script/plugin install git://github.com/finalist/readonly_fields.git

Usage

class Post < ActiveRecord::Base

  readonly_fields :title, :on => :update

end

All the usual validation options are available. See the documentation on ActiveRecord::Validations::ClassMethods#validates_each.

i18n

Translate it with the “readonly” key as you would normally do. See the Rails guide on internationalization for this.

Copyright © 2009 Iain Hecker, released under the MIT license