Ransack exception: Don't know how to klassify #<ActiveRecord::Associations::JoinDependency::JoinBase:0x007ffdf67a3360>

StackOverflow https://stackoverflow.com/questions/16229439

Frage

I'm new to Ransack. Tried to follow this RailsCast and install a Rails 4 compatible branch of Ransack. Upon hitting the submit button of the form, I get this error:

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

This is the rest of the code:

# 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)

What went wrong?

War es hilfreich?

Lösung

Turned out the Gem I was linking to is for Rails Edge and not for Rails 4 Beta. This worked:

gem "ransack", :git => "https://github.com/ernie/ransack", :branch => 'rails-4'
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top