kevincolyar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-May-28 00:30 UTC
Feedback for plugin: acts_as_readonly
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 git-9UaJU3cA/F/QT0dZR+AlfA@public.gmane.org:kevincolyar/ acts_as_readonly.git Thanks, Kevin
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, "kevincol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <kevincol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> All, > I''m just announcing and looking for feedback for a quick littleplugin 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 g...-9UaJU3cA/F/QT0dZR+AlfA@public.gmane.org:kevincolyar/ > acts_as_readonly.git > > Thanks, > Kevin