views:

18

answers:

1

I have created a new method in one of the project's controllers that it will allow the users to search using SearchLogic's gem.

The method is called search_entries and it is of course accompanied by a corresponding view. But when I hit the "Submit" button Rails complains that "Couldn't find Entry with ID=search_entries" (where Entry is the model.) In the params hash there is an ID with value "search_entries".

When I place the code from the search_enrties view inside the index template everything works without a problem (and no, the params hash does not have an ID...)

I am sure the problem is caused from a lack of understanding of how RoR works.

Thank you in advance for your time,

Angelos Arampatzis

A: 

i believe this is caused by the route entries in your config/routes.rb file as it's using RESTful actions. try to add a :search_entries => :get into the :collection of your resource.

more info can be found here: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions

hope it helps =)

Staelen
Thank you, it worked straight away! I knew it was something related to routes, but I didn't know how to handle the problem.
Angelos Arampatzis