Question: I've got a search working for my application however it only works for the first page when I click next page I get the following error: 

[![enter image description here](https://i.stack.imgur.com/R9mV1.png)](https://i.stack.imgur.com/R9mV1.png)

I've the following code in my vehicles controller: 

```
 def search
  vehicles = Vehicle.fuzzy_search(params[:search_string])
  @vehicles = Kaminari.paginate_array(vehicles.order:make).page(params[:page]).per(3)
  if @vehicles.empty?
    flash.now[:alert] = "No records found - displaying all records ..."
    @vehicles = Vehicle.order(:make).page(params[:page]).per(3)
  end
  render :action => "index"
 end

```

I've got the following code in my vehicle.rb 

```
def self.fuzzy_search(search_string)
    search_string = "%" + search_string + "%"
    self.where("make LIKE ?", search_string)
end

```

and my routes.rb has the following:

```
get 'vehicles/search', to: 'vehicles#search'
post 'vehicles/search', to: 'vehicles#search'

```

For some reason its trying to show a record which is called "search" rather then displaying the second page. I've spend hours trying to figure out why its doing this can someone please help! 

Edit --
Full Trace 
[![enter image description here](https://i.stack.imgur.com/bIz01.png)](https://i.stack.imgur.com/bIz01.png)
[![enter image description here](https://i.stack.imgur.com/KNXyp.png)](https://i.stack.imgur.com/KNXyp.png)

Answer: 
The problem maybe is on the next button, where you send the form where your Search also is, and the ID is sent as "search".

Would be amazing if you could edit with your search form and your next button html code.

(not enough rep to comment on you question, i will add this answer with an actual answer if i can provide you with one)
In your `config/routes.rb` file:

Move following lines to bottom of the file.

```
get 'vehicles/search', to: 'vehicles#search'
post 'vehicles/search', to: 'vehicles#search'

```