Hi Colin,
I've been searching the code, but not 100% sure what's up. It was ok
in dev, so can't explain it.. :-)
line 55 is this line here: users.each { |user| user.info ||=
Info.new }
Here's the full code from the buddies_controller:
def search
@title = "Find Buddies"
if params[:q]
query = params[:q]
curr_page = params[:page] || 1
users = User.find_with_ferret(query)
infos = Info.find_with_ferret(query)
hits = infos
users.concat(hits.collect { |hit| hit.user }).uniq!
users.each { |user| user.info ||= Info.new }
users = users.sort_by { |user| user.info.last_name }
@buddies = users.paginate(:page => curr_page, :per_page => 5)
end
end
Many, Many thanks!!
On 23 Jan, 20:32, Colin Law <[email protected]> wrote:
> On 23 January 2010 18:17, RubyonRails_newbie
>
>
>
>
>
> <[email protected]> wrote:
> > Hi there - i'm looking for anyone who 's experienced inconsistent
> > behaviour in ferret:
>
> > The search engine is somewhat temperamental, some words are returned,
> > and some result in a 500 server error...
>
> > the error in the log is as follows:. (this is straight off the
> > production log:
>
> > ** What's confusing, is that the engine does return some results, but
> > not always.. I know some words exist in the database, and I have also
> > reset the ferret server.
>
> > Processing BuddiesController#search (for 86.150.12.191 at 2010-01-23
> > 18:06:44) [GET]
> > Parameters: {"q"=>"craig"}
>
> > NoMethodError (undefined method `info' for nil:NilClass):
> > app/controllers/buddies_controller.rb:55:in `search'
>
> It appears that in line 55 of buddies_controller.rb you are calling
> something.info where something is nil (the clue is in the error
> message). Have a look to see why it might be nil. Post the code
> here if you cannot see it.
>
> Colin
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.