Undefined method `next_result 'for Mysql2 (rails 3)

I used the second version of the software and did not experience any problems. In my last application, I decided to use the latest "sphinx thinking." I have a strange mistake.

> NoMethodError in Adverts#index undefined method `next_result' for > #<Mysql2::Client:0xac86a54> 

My gemfile

  gem 'rails', '3.2.11' gem 'pg', '0.14.0' # My database # for sphinx gem "mysql2", "~> 0.3.11" gem "thinking-sphinx", "~> 3.0.0" 

Indices:

 ThinkingSphinx::Index.define :car, :with => :active_record do has user_id, model_id, city_id, area_id, engine_id, mileage end 

thinking_sphinx.yml

  development: port: 9312 test: port: 9313 production: port: 9312 

Controller:

 class AdvertsController < ApplicationController def index @cars = Car.by_model_id(@model_id) end end 

Model:

 class Car < ActiveRecord::Base include ThinkingSphinx::Scopes sphinx_scope(:by_model_id) { |id| {:with => {:model_id => id}} } end 

My opinion

% ul = render: partial => "item" ,: collection => @cars ,: as =>: item

element

% Li = item.id

What's wrong?

+8
ruby-on-rails ruby-on-rails-3 sphinx thinking-sphinx
source share
3 answers

I was going to go crazy after spending more than 2 hours on it before reading the READ ME document ( https://github.com/pat/thinking-sphinx ) again and found out that this is the called version of gem mysql.

Updating to 'mysql2', '0.3.12b4' solved the problem ....

+7
source share

gem 'mysql2', '~> 0.3.12b5' fixes this problem.

https://github.com/pat/thinking-sphinx/issues/446

Also works with 0.3.12b4.

+2
source share

It doesn't look like you are getting a result set with your query. You checked to see if you get results that you think should be. The console is a valuable tool for this. Check your query on the console to make sure. Also, can you consider checking the code if the result is empty? before you try to use it so that you do not encounter this in the manufacturing process.

0
source share

All Articles