2010-05-13 4 views
1

Mon erreur:Quelle est l'origine de cette erreur de méthode Rails?

Notez la méthode indéfinie '- @'.

Ceci est un tri par. Toutes sortes sur un saut de page, mais toutes les sortes sur les autres pages utilisent la même aide et ne cassent pas. Cela fait-il allusion à quelque chose d'évident?

Processing OrganizationsController#search (for ::1 at 2010-05-13 15:42:01) [GET] 
Parameters: {"action"=>"search", "controller"=>"organizations", "direction"=>"desc",  "_"=>"1273779721464", "order_by"=>"published_at"} 
    SQL (0.5ms) SHOW TABLES 
    Organization Columns (2.2ms) SHOW FIELDS FROM `organizations` 

NoMethodError (undefined method `[email protected]' for #<Array:0x2f88cc8>): 
app/controllers/organizations_controller.rb:190:in `search' 
sunspot (1.0.5) lib/sunspot/util.rb:84:in `call' 
sunspot (1.0.5) lib/sunspot/util.rb:84:in `instance_eval_or_call' 
sunspot (1.0.5) lib/sunspot/search.rb:200:in `build' 
sunspot (1.0.5) lib/sunspot/session.rb:45:in `new_search' 
sunspot (1.0.5) lib/sunspot/session.rb:53:in `search' 
sunspot (1.0.5) lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `search' 
sunspot (1.0.5) lib/sunspot.rb:323:in `search' 
app/controllers/organizations_controller.rb:183:in `search' 
haml (2.2.2) [v] rails/./lib/sass/plugin/rails.rb:19:in `process' 
lib/flash_session_cookie_middleware.rb:14:in `call' 
vendor/gems/hoptoad_notifier-2.2.2/lib/hoptoad_notifier/rack.rb:27:in `call' 
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' 
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' 
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' 
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start' 
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' 
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start' 
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each' 
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start' 
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start' 
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start' 

Rendered rescues/_trace (68.5ms) 
Rendered rescues/_request_and_response (0.6ms) 
Rendering rescues/layout (internal_server_error) 

Voici le code de mon Organization_Controller:

recherche def params [: q] = '' si params [: q] == ORGANIZATION_SEARCH_TEXT

s = Sunspot.search Organization do |query| 
    query.with(:searchable).equal_to 'true' 
    query.with(:updated_at).greater_than Time.zone.now-12.months 
    query.paginate :page => (params[:page] && params[:page].to_i || 1), :per_page => 20 
    query.keywords(params[:q]) { phrase_fields :quick_description => 3.0, :name => 3.0 } unless params[:q].blank? 
    -# query.keywords(params[:q]) { phrase_fields :name => 3.0 } unless params[:q].blank? 
    -# :name , :city 
    query.order_by(params[:order_by], params[:direction] || 'asc') if params[:order_by] && params[:order_by] != 'distance'     -# <-------- This is line 190/this comment is not in the real code 
    query.order_by('content_score', 'desc') if params[:q].blank? 
end 
+0

collez le code dans votre 'OrganisationsController' autour de la ligne' 190' –

+0

Afficher le code ici: app/controllers/organisations_controller.rb: 190 – simianarmy

+0

hors sujet: obtenir le mongrel gem pour remplacer webrick. – DJTripleThreat

Répondre

0

Je viens de découvrir que je suis bête! : D

Vous ne pouvez pas commenter les choses dans un contrôleur avec - #!

Questions connexes