From what I can understand, I should be able to treat an anonymous
scope as an intermediary object with which to build queries on the
fly.
Following the procedure in Railscast episode 112 (http://
railscasts.com/episodes/112), I try the following (in script/console):
a = Production.scoped({})
Hitting return results in a call to the database and all (hundreds of
thousands) records returned.
Is this the expected behavior?
I was hoping to use this to add various scopes according to the search
parameters requested, but I can't afford to do full table scans on
each step.
What could I be doing wrong?
The console is fooling you: it's trying to display a, and trying to
display it causes the scope to be loaded.
if you did a - Production.scoped({}); false
(so what the console displays is just false) then you should be ok