Feedback for plugin: acts_as_readonly


#1

All,
I’m just announcing and looking for feedback for a quick little
plugin I wrote: acts_as_readonly (http://github.com/kevincolyar/
acts_as_readonly/tree/master)

Some info:

ActsAsReadonly

acts_as_readonly is an ActiveRecord plugin that makes a model
readonly, preventing its attributes from being set and calling methods
like save, create, and destroy on it.

This plugin is useful for working with risky, legacy or third party
database where data is only being viewed.

Example

class MyModel < ActiveRecord::Base
acts_as_readonly
end

Installation

$ ./script/plugin install removed_email_address@domain.invalid:kevincolyar/
acts_as_readonly.git

Thanks,
Kevin


#2

Why not use ActiveRecord’s readonly!() feature while fetching the
record instead?

Readonly <> immutable in memory in my opinion. I don’t see why you
need to raise exceptions for column assignments as long as they are
not stored back to the database.

On May 28, 5:30 am, “removed_email_address@domain.invalid” removed_email_address@domain.invalid