Yes, and a querying DSL seems to solve this, at least from a syntax perspective.
Maybe: User.all do |users| users.active | users.confirmed end How does that sit? Tony On Oct 30, 2:13 pm, Jacques Crocker <[email protected]> wrote: > To expand on my earlier message (I should have read the entire thread > first), I agree with Thanatos that we need something within the actual > conditions hash without having to duplicate the finder syntax. It's > maybe a small thing, but having to duplicate the entire query call > just to add a simple OR query seems like a bit of problem. > > On Oct 30, 2009, at 10:46 AM, Thanatos wrote: > > > > > > > Could we add a some form of Union/Intersect to a conditions hash? so > > it could be User.all(Condition({:active => true}) | Condition > > ({:confirmed => false}))? This seems very unlikely and potentially > > more verbose, but thought I would throw it out there. The default > > would be to AND together, you could use |/& for union/intersect, and > > could group Condition within another Condition. > > > Either way, I like it and I think it's a solid improvement! > > > On Oct 30, 1:34 pm, "Dan Kubb (dkubb)" <[email protected]> wrote: > >> Whoops! Tiny correction on the SQL query examples, they should be: > > >> Union: > > >> User.all(:active => true) | User.all(:confirmed => false) > >> User.all(:active => true) + User.all(:confirmed => false) > >> # => SELECT * FROM users WHERE active = true OR confirmed = false > > >> Intersection: > > >> User.all(:active => true) & User.all(:confirmed => false) > >> # => SELECT * FROM users WHERE active = true AND confirmed = false > > >> Difference: > > >> User.all(:active => true) - User.all(:confirmed => false) > >> # => SELECT * FROM users WHERE active = true AND NOT(confirmed = > >> false) > > >> That's what I get for cutting and pasting ;) > > >> -- > > >> Dan > >> (dkubb) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
