Sign in through GitHub

RailsCasts Pro episodes are now free!

Learn more or hide this

Alfons's Profile

GitHub User: alfonskb

Comments by Alfons

Avatar

On rails 5 I couldn't get the code working correctly with the information presented by Luke Schoen. However, I got it working with the following code based on Rayn's code with the following adjustments:

app/models/product.rb: I used self.where for both cases and replaced "scoped" with "self.where(nil)".
app/helpers/application_helper.rb: I used request.query_parameters.merge to get the code working. (Also be aware of the double brackets) So: link_to title, request.query_parameters.merge({ sort: column_name, direction: direction, page: nil })