0

我是 Ransack 的新手。试图遵循这个RailsCast并安装 Ransack 的Rails 4 兼容分支。点击表单的提交按钮后,我收到此错误:

# @search = Resource.search(params[:q])
Don't know how to klassify #<ActiveRecord::Associations::JoinDependency::JoinBase:0x007ffdf67a3360>

这是代码的其余部分:

# controller
def index
  @search = Resource.search(params[:q])
  @resources = @search.result(:distinct => true)
end

# view (HAML)
= search_form_for @search do |f|
    = f.label :title_eq, "Title"
    = f.text_field :title_eq
    = f.submit "Search"

# Gemfile
gem "ransack", :git => "https://github.com/jonatack/ransack"

# Gemfile.lock
polyamorous (0.6.2)
  activerecord (>= 3.0)

什么地方出了错?

4

1 回答 1

0

原来我链接的 Gem 是用于 Rails Edge 而不是 Rails 4 Beta。这有效:

gem "ransack", :git => "https://github.com/ernie/ransack", :branch => 'rails-4'
于 2013-04-29T06:04:51.283 回答