I just entered this ticket.

http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/404-named_scope-bashes-critical-methods

It turns out that in an ActiveRecord model like this

Model << ActiveRecord::Base

   named_scope :public

   private
   def private_method
   end

   public
   def public_method
   end
end

The method public_method will be private because named scope overrides
Ruby's public method!  Also this can cause additionally hard to debug
failures in metaprogramming, I discovered this when the RSpec stub! method
blew up when it used class_eval to generate a stub method which apparently
caused public to be called internally by Ruby, at which time the named_scope
generated method failed.

See the ticket for details.

I'm not sure what the fix should be, but I think that named_scope should not
cause public/private, and the like to be clobbered.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to