I am using a smallint database column to store several boolean flags. The flags are accessible thru facade column accessors. I''d like to hide the database column so all access is thru the facade accessors. How do I do it? TIA, Jeffrey
Jeffrey L. Taylor wrote:> I am using a smallint database column to store several > boolean flags. The flags are accessible thru facade column > accessors. I''d like to hide the database column so all > access is thru the facade accessors. How do I do it?Module#private. class Foo def some_column puts "a value!" end def go_here_instead some_column end private :some_column end Foo.new.some_column >> NoMethodError Foo.new.go_here_instead >> a value! http://lnk.nu/ruby-doc.org/9w5.html -Drew
Jeffrey L. Taylor wrote:> I am using a smallint database column to store several boolean flags. > The flags are accessible thru facade column accessors. I''d like to > hide the database column so all access is thru the facade accessors. > How do I do it? > > TIA, > JeffreyGood solution above. However, why would you want to do such a thing? Space savings? I think you''re spending too much time on some minute facet of the app instead of actually developing useful code. Just my 2 cents. -- Posted via http://www.ruby-forum.com/.