This project is archived and is in readonly mode.

#5456 ✓duplicate
Dim

AREL is building incorrect conditions when line-breaks are included

Reported by Dim | August 25th, 2010 @ 05:51 PM

I have the following problem with ActiveRecord 3.0.0.RC2:

  > Account.where(:name => "some\nname").to_sql
  => "SELECT     \"accounts\".* FROM       \"accounts\"  WHERE     (\"accounts\".\"name\" = 'some\n AND name')"

But - of course - it should be:

  => "SELECT     \"accounts\".* FROM       \"accounts\"  WHERE     (\"accounts\".\"name\" = 'some\nname')"

I tried to trace the problem but couldn't find it. Individual to_sql calls seem to be doing the right thing (see below):

  > Account.where(:name => "some\nname").where_values.first.to_sql
  => "\"accounts\".\"name\" = 'some\nname'"

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages