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
-~----------~----~----~----~------~----~------~--~---

Reply via email to