3

First, I do simple squeel testing in the Rails console.

User.where{name == "abc"}

There is no problem for new-created Ruby project

User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."name" = 'abc' => [] 

However, when I apply it on my existing project, it gives me error message:

1.9.3p125 :001 > User.where{name == "abc"}
ArgumentError: wrong number of arguments (0 for 1)  from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/parse_resource-1.7.3/lib/parse_resource/query.rb:11:in `where'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/parse_resource-1.7.3/lib/parse_resource/base.rb:243:in `where'
    from (irb):1
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.3/lib/rails/commands/console.rb:47:in `start'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in `start'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.3/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

The most-related issue I found is Squeel issue #193.

It says that Squeel is not loaded. But, in my case, new-created can be implemented in the same machine.

Anyway, I try to change active_record.rb as it stated, but the problem is still here for my existing project.

I'm using Ruby-1.9.3-p125, Rails v3.2.6, and Squeel 1.0.14.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
Vincent
  • 33
  • 4
  • 1
    Your Rails & Ruby versions are both out-of-date and newer versions have important security fixes. You should upgrade to the latest versions as soon as possible. – Andrew Marshall Dec 06 '12 at 05:42
  • Ture and I will do it later on. But actually I am restricted by Heroku, a cloud sevice. I have to follow its ruby version to ensure my website is work. – Vincent Dec 06 '12 at 06:27
  • Is there possible conflict between gems, parse_resource and squeel? – Vincent Dec 06 '12 at 06:38
  • Same problem, posted to github: https://github.com/ernie/squeel/issues/206 – Tyler DeWitt Dec 07 '12 at 01:18

1 Answers1

-1

Well instead of using where clause you can use:

User.filter(:name => 'abc').first

This might work in your case

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
barkha
  • 1