RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: lgallo
My way to solve that issue:
Use the column name with a table alias, for example: 'us.name'.
In the controller, always retrieve info joining the other table, with its alias 'Product.joins('JOIN table alias ON field = field')'
And then use as the column name, the alias + the column name, as I stated before.
And remember to include this 'special' name in the valid column names in the sort_column private method.
Hope it helps!