looooong time reader and knowledge attainer, first time poster. I've started learning Rails and I definitely need help.
I am following a tutorial with this code:
class BooksController < ApplicationController
def index
if params[:query].present?
@books = Book.search(params[:query], page: params[:page])
else
@books = Book.all.page params[:page]
end
end
And I am trying to apply this to my own project (I have 'destinations' not 'books'). What I don't understand is what is the .page parameter and where is it generated from?
I am getting an "undefined method "page" on my Controller and I don't understand what it is.
This is my code:
class DestinationsController < ApplicationController
def index
if params[:query].present?
@destination = Destination.search(params[:query], page: params[:page])
else
@destination = Destination.all.page params[:page]
end
end
The only field I have in the Destinations table is country. I thought maybe that could replace it but alas, no. Yes, I'm very new to this. Any help is appreciated.