# Ez-where plugin and type mismatch

**URL:** <https://www.ruby-forum.com/t/ez-where-plugin-and-type-mismatch/72331>\
**Category:** Rails\
**Created:** [October 16, 2006, 3:16pm UTC](https://www.ruby-forum.com/t/ez-where-plugin-and-type-mismatch/72331 "2006-10-16T15:16:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 16, 2006, 3:16pm UTC](https://www.ruby-forum.com/t/ez-where-plugin-and-type-mismatch/72331/1 "2006-10-16T15:16:36Z")

</div>

I’m getting an error

type mismatch: String given

RAILS\_ROOT: ./script/…/config/…  
Application Trace [http://localhost:3000/ajaxsearch/index#](http://localhost:3000/ajaxsearch/index#) | Framework  
Trace [http://localhost:3000/ajaxsearch/index#](http://localhost:3000/ajaxsearch/index#) | Full  
Trace[http://localhost:3000/ajaxsearch/index#](http://localhost:3000/ajaxsearch/index#)

#{RAILS\_ROOT}/app/controllers/ajaxsearch\_controller.rb:26:in `=~' #{RAILS_ROOT}/app/controllers/ajaxsearch_controller.rb:26:in `list’  
#{RAILS\_ROOT}/app/controllers/ajaxsearch\_controller.rb:22:in `list’

cond = EZ::Where::Condition.new do  
category\_id === [category\_id] # these are integers coming in  
state\_id === [state\_id] # same  
term\_id === [term\_id] # same  
city =~ ‘%city’ # this would be a string  
title =~ ‘%title’ # string as well

```
  end

```

## Something wrong here ? Stuart

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 16, 2006, 3:20pm UTC](https://www.ruby-forum.com/t/ez-where-plugin-and-type-mismatch/72331/2 "2006-10-16T15:20:37Z")

</div>

I don’t know this plugin at all, but normally you need to give a  
|thingie| in a block, so my guess would be:

cond = EZ::Where::Condition.new do |ez|  
ez.category\_id === [category\_id] # these are integers coming in  
ez.state\_id === [state\_id] # same  
ez.term\_id === [term\_id] # same  
ez.city =~ ‘%city’ # this would be a string  
ez.title =~ ‘%title’ # string as well

```
  end

```

i could be totally wrong though 😃

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 16, 2006, 3:26pm UTC](https://www.ruby-forum.com/t/ez-where-plugin-and-type-mismatch/72331/3 "2006-10-16T15:26:44Z")

</div>

On 10/16/06, Dark A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> #{RAILS\_ROOT}/app/controllers/ajaxsearch\_controller.rb:26:in `list’
> 
> Something wrong here ?  
> Stuart

=~ is looking for a regexp.

instead of providing ‘%city’ try using /city$/

Or something similar.

Cheers

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 16, 2006, 3:57pm UTC](https://www.ruby-forum.com/t/ez-where-plugin-and-type-mismatch/72331/4 "2006-10-16T15:57:40Z")

</div>

On Oct 16, 9:23 am, “Daniel N” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > RAILS\_ROOT: ./script/…/config/…  
> > term\_id === [term\_id] # same  
> > Or something similar.
> 
> Cheers

No, ‘=~’ maps to a LIKE SQL action, so the format specified is correct.

He is missing a table name for the block… It should be something  
like this…

cond = EZ::Where::Condition.new :some\_table\_name do  
category\_id === [category\_id] # these are integers coming in  
state\_id === [state\_id] # same  
term\_id === [term\_id] # same  
city =~ ‘%city’ # this would be a string  
title =~ ‘%title’ # string as well  
end

\_Kevin
