+1 to rolling back this change until there's a way to make with_scope
available to association extensions.

The useful (and AFAIK popular) technique for creating typed join
models detailed at
http://blog.hasmanythrough.com/2006/8/19/magic-join-model-creation is
broken by making with_scope protected.

On 6/18/07, dasil003 <[EMAIL PROTECTED]> wrote:
>
> 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
>   def accessible_property_find(*args)
>     Property.with_scope(:find => accessible_property_options) do
>       Property.find(*args)
>     end
>   end
> end
>
> 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
> the user.
>
> So I'm requesting that this change be rolled back.  Thoughts?
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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