English 中文(简体)
NoMethodError in rails
原标题:

The extracted source is below :

Showing /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/templates/rescues/diagnostics.erb where line # raised:

private method `gsub  called for #<NoMethodError: undefined method `closed?  for nil:NilClass>

Extracted source (around line #):

RAILS_ROOT: /home/sharath/Desktop/RORWorkspace/ITPLOW1

It was working before installing Sunspot: A Solr-Powered Search Engine for Ruby.

I am working in Ubuntu 10.04.

最佳回答

I d need to see the full stacktrace to be sure, but this is actually probably an unhelpful HTTP connection error message bubbling up out of RSolr (the library the Sunspot uses for the low-level Solr connection). Is Solr running (i.e., did you run rake sunspot:solr:start)? Can you access http://localhost:8982/solr/admin ?

问题回答

What s probably happening is you re attempting to do a substitution on some variable which you thought you were initializing, but neglected to give a real value.

For instance, if you had a form where for a Message and one of the the properties you want is the content, you would normally retrieve that information in the controller with

params[:message][:content]

And if you wanted to filter it, you would do something like

params[:message][:content].gsub(/<[^>]*>/,"")

But if the user didn t enter anything into the content field, the params[:message][:content] variable wouldn t be set. Therefore it s null and you re attempting to do nil.gsub





相关问题
Acronyms with Sphinx search engine

how can i index acronyms like m.i.a. ? when i search for mia , i get results for mia and not m.i.a. . when i search for m.i.a. , i get nothing at all. edit: solution looks roughly like: ...

Querying multiple index in django-sphinx

The django-sphinx documentation shows that django-sphinx layer also supports some basic querying over multiple indexes. http://github.com/dcramer/django-sphinx/blob/master/README.rst from ...

Adding Search to Ruby on Rails - Easy Question

I am trying to figure out how to add search to my rails application. I am brand new so go slow. I have created a blog and done quite a bit of customizing including adding some AJAX, pretty proud of ...

Searching and ranking short phrases (e.g. movie titles)

I m trying to improve our search capabilities for short phrases (in our case movie titles) and am currently looking at SQL Server 2008 Full Text Search, which provides some of the functionality we ...

Will Full text search consider indexes?

Ok I have a full text search index created on my JobsToDo table, but what I m concerned about is if this is rendering my other indexes on the table useless. I have a normal nonclustered index on the ...

Lucene.NET on shared hosting

I m trying to get Lucene.NET to work on a shared hosting environment. Mascix over on codeproject outlines here how he got this to work on godaddy. I m attempting this on isqsolutions. Both ...

Hibernate Search or Compass

I can t seem to find any recent talk on the choice. Back in 06 there was criticism on Hibernate Search as being incomplete and not being ready to compete with Compass, is it now? Has anyone used both ...

热门标签