fixes queries for rails 4