Ok, so the error that is being thrown is a result of a different issue
(isolated and discussed in another thread).

Question is still open though, is there a better way to write OR
queries in datamapper 0.10?

Thanks!


On Oct 2, 4:34 am, Jacques Crocker <[email protected]> wrote:
> Via Datamapper 0.10, is there a mechanism to better handle  
> conditionals with OR (instead of AND)?
>
> I had my ghetto search query break from 0.9 to 0.10:
> all(["(title like ? OR description_source like ? OR company_name  
> like ? OR outside_location like ?)", search, search, search, search])
>
>   I know there's the much fancier :name.like => "" , however I  
> couldn't figure out how to make it work with an OR query. Can anyone  
> help?
>
> Here's the stack trace I get on the above query. the search variable  
> is just a simple string
>   ~ Binding mismatch: 2 for 1
> INTERNAL ERROR!!! Binding mismatch: 2 for 1
>         /Users/jc/Merb/testapp/gems/gems/data_objects-0.10.0/lib/data_objects/
> command.rb:73:in `escape_sql'
>         /Users/jc/Merb/testapp/gems/gems/dm-core-0.10.0/lib/dm-core/adapters/
> data_objects_adapter.rb:88:in `execute_reader'
>         /Users/jc/Merb/testapp/gems/gems/dm-core-0.10.0/lib/dm-core/adapters/
> data_objects_adapter.rb:88:in `read'
>         /Users/jc/Merb/testapp/gems/gems/dm-core-0.10.0/lib/dm-core/adapters/
> data_objects_adapter.rb:266:in `with_connection'
>         /Users/jc/Merb/testapp/gems/gems/dm-core-0.10.0/lib/dm-core/adapters/
> data_objects_adapter.rb:84:in `read'
--~--~---------~--~----~------------~-------~--~----~
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