Update queries for Rails 4.1
Merge pull request #225 from leematos/master

Rails 4.1 fixes