Additive Chaining with named_scope

asked16 years ago
last updated16 years ago
viewed2.9k times
Up Vote9Down Vote

Is there a way to combine scopes in an additive fashion?

If I have the scopes

User.big_haired

and

User.plays_guitar

I can call

User.big_haired.plays_guitar

and get all the users who have big hair AND play guitar. Can I write this to get all users who have big hair OR play guitar?

I guess I have to add that I realize that you can run a set of queries and add the results together. That's what I'm trying not to do.