From: Gaspard Bucher Date: 2007-09-25T04:40:18+09:00 Subject: Re: best way to 'hide' a method when method_missing is in town What about this solution ? class HidenMethod < Exception; end module Hide def self.included(klass) klass.class_eval <<-END_TXT @@hidden_methods = [] def self.hide(method) private method @@hidden_methods << method.to_sym end def method_missing(method, *args) raise Hide::HidenMethod.new("Hidden \#{method} called.") if @@hidden_methods.include?(method) super end END_TXT end end class Base def method_missing(method, *args) puts "#{method} caught in base" end end class Sub < Base include Hide def see_me puts 'hi' end def no_see puts 'hidden' end hide :no_see end s = Sub.new s.see_me s.no_see > > On Sep 24, 12:34 pm, "Gaspard Bucher" wrote: > > Shouldn't you just use attr_protected ? > > class Node < ActiveRecord::Base > > attr_protected :no_see > > end > > > > It does not prevent the attribute from being used from an instance of > the object. > > Kevin >