Was reading up on with_scope and came across this via err.the_blog
> Deprecation is a step too far, there are legitimate uses of
> with_scope, particularly around encapsulated finds for permissions
> models. I just think that there needs to be some serious warnings in
> the documentation:
The decision has been rendered as follows: with_scope will go protected
from Rails 2.0. That means you''ll be able to use with_scope in your own
private finders (the only legitimate use I''ve seen), but not in, say,
filters.
Now we just have to find a way to get those deprecation messages in
there when its being called in the public space.
--
I am still rather a newbie so I am not 100% sure what the implications
are. Does this mean that you will not be able to use (for example)
Model.with_scope( :find => {conditions = "blah" } do
Model.count
end
In your controllers? One reason I do use them in controllers is that it
allows me to add conditions based on things not accessible from the
model (Such as a session variable).
For example
def foo
if session[:bar] == blah
result = "field > 10"
end
end
Model.with_scope( :find => {conditions = foo } do
Model.count
end
Since it is a total pain in the arse to get such data into models
removing with_scope from controllers would be a kick in the nuts (to mix
metaphors).
Can anyone RubyGroupie shed some light on this?
thanks
RJ
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---