There’s an example in the book that presents a search form , listing
users
and their favorite languages below it. Using the search form text field
you
can filter the list by their favorite language.
I did the demo from the book using the same schema and it works.
However, I’m trying to implement this same thing in my app which uses
REST
controllers, and am running into an error when loading the search form.
The
error is:
ActiveRecord::RecordNotFound in PositionsController#show
Couldn’t find Position with ID=search_position
I’m assuming the issue is in the search action in the controller. The
list.rhtml should return all the positions. It all looks pretty
straight
forward.
In the controller:
def search
unless params[:search].blank?
@position_pages, @positions = paginate :positions,
:per_page => 10,
:order => order_from_params,
:conditions => Position.conditions_by_like(params[:search])
logger.info @positions.size
else
list
end
render :partial => 'search', :layout => false
end
I’m showing the get/show in the controller - though I’m not sure if or
why
it would intefere with the search action.
def show
@position = Position.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @position.to_xml }
end
end