This project is archived and is in readonly mode.

#5436 ✓duplicate
Nicolas Blanco

RC1 to RC2 regression : multilines where conditions autojoin with "AND"

Reported by Nicolas Blanco | August 24th, 2010 @ 10:57 AM

Hi,

the behaviour when using multilines where conditions is different between Rails 3 RC1 and Rails 3 RC2.

class User < ActiveRecord::Base
    scope :test_scope,
               where("active = ?
                      and login like ?", true, "%test%")
end
$-> rails c
Loading development environment (Rails 3.0.0.rc)
irb(main):001:0> User.test_scope.to_sql
"SELECT     \"users\".* FROM       \"users\" WHERE     (active = 't'\n                      and login like '%test%')"
$-> rails c
Loading development environment (Rails 3.0.0.rc2)
irb(main):001:0> User.test_scope.to_sql
"SELECT     \"users\".* FROM       \"users\"  WHERE     (active = 't'\n AND                       and login like '%test%')"

As you can see in RC2, it autojoins split lines with "AND" and results in faulty SQL.

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>

Pages