hi all,
thanks for you reply,
2009/11/9 Peter De Berdt [email protected]
I could of course write that in some other way, but the question would be:
arguments to this method as you can
# to find(:all)
def all(*args)
find(:all, *args)
end
A quick google search revealed this blog post:
http://www.neeraj.name/blog/articles/871-fixing-activerecord-base-all-and-making-it-friendlier-to-named_scope
Peter yep, nice post, only for the moment I don’t feel like patching
AR::Base, and I get lots of warnings when running my specs:
/home/joahking/dev/rails/tucamon/app/models/group.rb:44: warning:
multiple
values for a block parameter (0 for 1)
from
/home/joahking/dev/rails/tucamon/vendor/rails/activerecord/lib/active_record/named_scope.rb:92
line 44: named_scope :all, lambda { |args| args ||= {} }
I’ll go with HeChian H. idea, it ended like this:
gs = if PrivacyLevels.include? privacy
self.send privacy
else
self # AR itself
end
if name
gs.named_like name
else
gs.all # and all again
end
I know it’s not a very general solution, but it keeps all them specs
green

I have to move on given my deadlines, but if I stumble again I’ll give a
second thought
thanks for your responses,
joaquin
It outlines both the problem and provides a solution. I do agree that
since
problems more elegantly afaik, like Datamapper and Arel.
Best regards
Peter De Berdt
–
www.least-significant-bit.com