Fixes #6468 - Allow filtering/searching by active user

Turns out using ` for quoting column names works only on mysql/sqlite - which caused the tests to break on postgesql. 
Using User.connection.quote_column_name(...) quotes the name correctly for each db and now tests pass.