fix bug with unprepared statements to sql in Rails 4