#532 invalid
Jeremy Nicoll

Suggested syntax for "OR" queries

Reported by Jeremy Nicoll | August 18th, 2008 @ 10:29 AM

I was thinking about this issue this morning, and I figured I would post this for consideration. I was thinking that multiple hashes could be used for "OR" queries like so:

User.all({:is_admin => true}, {:can_post => true, :likes_the_color => 'blue'})

This would generate the SQL of:

"SELECT * FROM users WHERE (is_admin = 1) OR (can_post = 1 AND likes_the_color = 'blue')"

Comments and changes to this ticket

  • Jeremy Nicoll

    Jeremy Nicoll August 19th, 2008 @ 10:43 AM

    • Tag changed from dm-core to dm-core, suggestion

    Of course, this might fail on the order/limit/etc stuff. Then again, this could just be extracted from the first hash and then the query conditions parsed in this way.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 2nd, 2008 @ 03:51 AM

    • State changed from “new” to “invalid”
    • Assigned user cleared.

    I'm going to mark this as invalid for now. We'll be working on the OR conditions once the DM spec/doc rewrite is done, and the mailing list would probably be a better place to discuss the potential changes to the DM API to support OR.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket