attr_private for hiding a database column, improves encapsulation

I'd like your feedback on a patch I submitted. I've included an excerpt from it below. http://dev.rubyonrails.org/ticket/8355

[PATCH] attr_private for hiding a database column, improves encapsulation

This is a patch on ActiveRecord that creates 'attr_private'. attr_private provides a way to make one or more database columns appear to be private. This allows AR models to be better encapsulated, meaning that they can hide their implementation details.

class NegotiatingAgent < ActiveRecord::Base   attr_private :min_acceptable_price end

r = NegotiatingAgent.new r.min_acceptable_price # => NoMethodError r.min_acceptable_price = 350 # => NoMethodError r[:min_acceptable_price] # => PrivateAttributeError r[:min_acceptable_price] = 250 # => PrivateAttributeError r.attributes # will not include :min_acceptable_price

More information on the motivating reasons (and other workarounds I tried first) can be found in Trac: http://dev.rubyonrails.org/ticket/8355

Thanks, David James

P.S. I'm at RailsConf, please say hi if you see me.