jhund / filterrific

Filterrific is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.
http://filterrific.clearcove.ca
MIT License
910 stars 125 forks source link

Documentation needs to be updated concerning sorting by associated model #144

Closed acrolink closed 6 years ago

acrolink commented 7 years ago

I have found that this code as outlined in documentation throws an error:

  when /^country_name_/
    # This sorts by a student's country name, so we need to include
    # the country. We can't use JOIN since not all students might have
    # a country.
    order("LOWER(countries.name) #{ direction }").includes(:country)
else

I had to change like this to work: order("LOWER(countries.name) #{ direction }").includes(:country).references(:country)

jhund commented 6 years ago

@acrolink thanks for the issue. This is now fixed.