微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – Mysql2的未定义方法`next_result'(rails 3)

我曾经使用该软件的第二个版本,没有任何问题.在我的上一次申请中,我决定使用最新的“思考 – 狮身人面像”.我有一个奇怪的错误.
> NoMethodError in Adverts#index undefined method `next_result' for
> #<MysqL2::Client:0xac86a54>

我的宝石文件

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"

索引:

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

控制器:

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

模型:

class Car < ActiveRecord::Base
    include ThinkingSphinx::Scopes

    sphinx_scope(:by_model_id) { |id|
      {:with => {:model_id => id}}
    }
end

我的看法

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

项目

%li=item.id

怎么了?

解决方法

在我花了超过2个小时的时间之后我才开始疯狂,然后再次仔细阅读READ ME文档( https://github.com/pat/thinking-sphinx)并发现它是导致的MysqL gem版本.

升级到’MysqL2′,’0.3.12b4’解决了这个问题….

原文地址:https://www.jb51.cc/ruby/269971.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐