Ez-where plugin and type mismatch

I’m getting an error

type mismatch: String given

RAILS_ROOT: ./script/…/config/…
Application Trace http://localhost:3000/ajaxsearch/index# | Framework
Trace http://localhost:3000/ajaxsearch/index# | Full
Tracehttp://localhost:3000/ajaxsearch/index#

#{RAILS_ROOT}/app/controllers/ajaxsearch_controller.rb:26:in =~' #{RAILS_ROOT}/app/controllers/ajaxsearch_controller.rb:26:inlist’
#{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

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 :smiley:

On 10/16/06, Dark A. [email protected] 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

On Oct 16, 9:23 am, “Daniel N” [email protected] 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs