How can I turn a filter on an array of ActiveRecord objects into a scope?
For example turn this:
Users.all.collect { |u| u.has_super_powers? }
Into:
scope :supers, #something here
The point is that it can be used as a scope so Users.all is not always "all" like:
Users.undeleted.supers.find_by_this('that')
I thought maybe using lambda expressions in scopes is the way, but don't think that would work since I don't have access to records as the expression is added to a DB query and not run as a post step over the results.
has_super_powers?Scopes will only work on data inside the database, not Ruby methods.