RecordNotFound with ID=search?


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 = params[:q]

My model question.rb is so:

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

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?

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