Areas scopein rails 3 and named_scopein rails 2.
class Bar
scope :custom_find, lambda {|baz| where(:whatever => baz) }
end
foo_instance.bars.custom_find(baz)
scopeshould return an area, so given your update, you probably don't want to use scopehere. However, you can write a class method and use it scopedto access the current scope, for example:
class Bar
def self.custom_find(thing)
if bar = scoped.find_by_pineapple(thing)
bar.monkey
else
:banana
end
end
end