0

得到一个源自 ActiveResource 标准 Rails 库的模糊错误。Rails 中导致此问题的行与输出一起在下面给出。请问如何解决这个问题?

class Search < ActiveResource::Nestful::Base

  self.collection_name = "search"

  schema do
    string :type
    object :event
  end

def self.query(params)
   find(:all, :params => params)
end

def self.per_page
  3
end

def record
  attributes[attributes["type"]]
end
end

输出

Started GET "/search?utf8=%E2%9C%93&q=Hammersmith&location=&commit=Search" for 127.0.0.1         at 2012-09-17 15:10:53 +0100
Processing by SearchController#index as HTML
Parameters: {"utf8"=>"✓", "q"=>"Hammersmith", "location"=>"", "commit"=>"Search"}
Completed 500 Internal Server Error in 2343247ms

NoMethodError (undefined method `body' for #<Hash:0xbc3ee74>):
 activeresource (3.2.8) lib/active_resource/base.rb:901:in `find_every'
 activeresource (3.2.8) lib/active_resource/base.rb:814:in `find'
 app/models/search.rb:12:in `query'
 app/controllers/search_controller.rb:14:in `index'
 actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
 actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'
 actionpack (3.2.8) lib/action_controller/metal/rendering.rb:10:in `process_action'
 actionpack (3.2.8) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
 activesupport (3.2.8) lib/active_support/callbacks.rb:426:in `block in      _run__1005704495__process_action__837521650__callbacks'
 activesupport (3.2.8) lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_208'
 app/controllers/application_controller.rb:55:in `block in with_oauth'
 /home/jaygemang/.rvm/gems/ruby-1.9.3-p194/bundler/gems/activeresource-nestful-3b28ffcfe788/lib/active_resource/nestful.rb:15:in `oauth'
4

1 回答 1

2

我会进去看看app/models/search.rb:12:in `query'

于 2012-09-17T15:07:50.263 回答