Search code examples
ruby-on-railsrubyruby-on-rails-3.2squeel

Trying out Squeel but symbols don't seem to work


I'm trying the following query

  results = Tickets.order("created_at DESC").where({
    (title =~ params[:title]) &
    (name =~ params[:from]) |
    (problem =~ params[:includes]) &
    (problem !~ params[:excludes])
  })

but the following error occurs

syntax error, unexpected '}', expecting tASSOC (problem !~ params[:excludes])})

and for the other lines too

but the squeel doc says to do:

Person.where{(name =~ 'Ernie%') & (salary < 50000) | (name =~ 'Joe%') & (salary > 100000)}

ps, i've spotted it. first to spot it too gets a tick.


Solution

  • You have an extra set of parentheses: one immediately after "where" and one at the very end.