Fixed exec_query for rails 4
Fixed bug with Rails 4