There is also boolean in it:

fields = [
  {
   name: 'John',
   subject: 'Hello',
   is_ok: true
  },
  {
   name: 'Mark',
   subject: 'Hi',
   is_ok: false

  }
]



On Sunday, May 26, 2019 at 6:10:45 PM UTC+3, xura wrote:
>
> I have this hash:
>
> fields = {
>   name: 'John',
>   subject: 'Hello'
> }
>
>
> And I send this hash by this:
>
> Email.where(fields).where(another_condition: 4).all
>
> It works, however, When I want to add OR I need to explicitly define them:
>
> fields = [
>   {
>    name: 'John',
>    subject: 'Hello'
>   },
>   {
>    name: 'Mark',
>    subject: 'Hi'
>
>   }
> ]
>
>
> What I am trying to do here is merge this array of hashes in single WHERE 
> with OR:
>
>
> SELECT * FROM emails WHERE another_condition = 4 AND (PUT ORs HERE)
>
> which should look like:
>
> SELECT * FROM emails WHERE another_condition = 4 AND ((name = "John" and 
> subject = "Hello") OR (name = "Mark" and subject = "Hi"))
>
> How can I do that with Sequel using array of hashes so array oıf hashes 
> becomes ORs (I will add more where (and) after)
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/edb98989-75d2-4e26-808d-d00026e27bf8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to