I recently upgraded my edge rails in order to take advantage of the
view_paths patch Rick applied the other day, and discovered with_scope
is now protected. I'm well aware of the abuses of with_scope, but
isn't this approach sort of heavy-handed? Since when has Rails been
about protecting programmers from themselves?
If core needed with_scope to implement assocations doesn't it stand to
reason that a Rails developer might need similar functionality? Let
me give you my use case:
class User < ActiveRecord::Base
Property.with_scope(:find => accessible_property_options) do
A couple of things to note here:
* I'm not using this in a controller in a mysterious way, it's in a
model as it should be, but the protected method is still inaccessible
since I'm calling it from a different model.
* An association doesn't do the trick here, the actual conditions vary
depending on user type and aren't a simple foreign key.
* I know I could work around this by refactoring the functionality
into Property and passing the user as a parameter, but that makes my
code both more complicated and more opaque. The User should know what
properties it can access. A Property shouldn't have any concept of
So I'm requesting that this change be rolled back. Thoughts?