Due to rails 4 master remove to_sql, so also remove here

https://github.com/rails/rails/commit/1c9f7fa6e17d3b026ad6e0bc1f07a9dd47d8a360