the first page of the view is fine, but when i click on page 2, it says
that i have a nil object. i traced back and printed out to the screen
‘category’ in the application.rb file, and it turns out it goes NIL
after selecting the 2nd page!.. so how can this be fixed? for some
reason, this problem only ocurs when i need to pass a variable to my
paginate query object.
It looks like you’re relying on params[:category] to persist across
pages.
That won’t happen. You have to store it in the session hash. Then you
can
write code like:
def view
first visit, user supplies category
session[:category] = params[:category] if params[:category]
any visit, refer to session hash to get category value
hi steve,
thank you for responding. i will try this when i get home. appreciate
the help!
Steve R. wrote:
It looks like you’re relying on params[:category] to persist across
pages.
That won’t happen. You have to store it in the session hash. Then you
can
write code like:
def view
first visit, user supplies category
session[:category] = params[:category] if params[:category]
any visit, refer to session hash to get category value