Adding in Search for Rails
Published in
2 min readFeb 27, 2017
Creating simple search like functionality in your rails project can be tricky compared to using something like Angular.
In this example I had a list of park names that I wanted to search through without combing the entire list.
First in the controller, setup the search params statement following your index method. This example also includes the use of pagination.
Then in your model choose the fields that you would like your search method to go through. In this example the search term will be run against the name field of each park.
Finally add in the search bar to your view!
Check out your page for some serious search!
// Using Rails 5