mirror of
https://github.com/github/rails.git
synced 2026-04-04 03:00:58 -04:00
SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find. References #2974.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3184 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find. #2974 [kajism@yahoo.com]
|
||||
|
||||
* Reloading a model doesn't lose track of its connection. #2996 [junk@miriamtech.com, Jeremy Kemper]
|
||||
|
||||
* Fixed bug where using update_attribute after pushing a record to a habtm association of the object caused duplicate rows in the join table. #2888 [colman@rominato.com, Florian Weber]
|
||||
|
||||
@@ -356,7 +356,12 @@ module ActiveRecord
|
||||
if options[:order]
|
||||
options[:order] = options[:order].split(',').map do |field|
|
||||
parts = field.split(" ")
|
||||
if sql =~ /#{parts[0]} AS (t\d_r\d\d?)/
|
||||
tc = parts[0]
|
||||
if sql =~ /\.\[/ and tc =~ /\./ # if column quoting used in query
|
||||
tc.gsub!(/\./, '\\.\\[')
|
||||
tc << '\\]'
|
||||
end
|
||||
if sql =~ /#{tc} AS (t\d_r\d\d?)/
|
||||
parts[0] = $1
|
||||
end
|
||||
parts.join(' ')
|
||||
|
||||
Reference in New Issue
Block a user