路由错误,使用Sunspot Solr / Rails </class ......>#<class ......>的未定义方法`searchable'>

时间:2012-08-05 17:53:23

标签: ruby-on-rails ruby-on-rails-3 sunspot sunspot-rails sunspot-solr

我已将Sunsport Solr添加到我的Rails应用程序中。我想要搜索的模型抛出Routing Error异常,抱怨undefined method 'searchable' for #<Class..........>。我已经遵循了几个不同的设置指令集,它们都提供了相同的信息,我已完全匹配。我似乎无法确定问题所在。相关的片段如下。

#dwelling.rb
class Dwelling < ActiveRecord::Base
  attr_accessible :street_address, :city, :state, :zip, :nickname

  searchable do
    text :nickname
  end
...

-

#dwellings_controller.rb
class DwellingsController < ApplicationController

  before_filter :signed_in_user

  def index
    @search = Dwelling.search do
      fulltext params[:search]
    end
    @dwellings = @search.results
  end

-

#Gemfile
source 'https://rubygems.org'

gem 'rails', '3.2.6'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'sunspot_rails', '~> 1.3.0'


# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :development do
gem 'sqlite3', '1.3.5'
gem 'sunspot_solr'
end

有时,如果我刷新几次,则会抛出有关key?方法的单独错误。完全错误如下。

NoMethodError in DwellingsController#index

undefined method `key?' for nil:NilClass

我不仅仅是困惑 - 任何想法?

0 个答案:

没有答案