RecordNotFound with ID=search?

Hello,

I’ve installed the plugin act_as_ferret and I try to install this on my
model “question”.

For this, I’ve then add this in questions_controller.rb

def search
@results = Question.find_by_contents(@search) unless
@search.to_s.blank?
@search = params[:q]
end

My model question.rb is so:

class Question < ActiveRecord::Base
acts_as_ferret :fields => [ :description, :answer ]
end

In the view search.html.erb I’ve added this:

<% if @results %>
<% for question in @results %>
<%= question.description %>
<% end %>
<% else %>

No result


<% end %>

In the file application.html.erb, I’ve add a form to make the search so:



With sending of a search, I receive this notification:
ActiveRecord::RecordNotFound in QuestionsController#show
Couldn’t find Question with ID=search

Someone has an idea?
Thanks,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs