我在一个红宝石世界,使用 activerecord (3.2.11)、tiny_tds (0.5.1-x86-mingw32) 和 activerecord-sqlserver-adapter (3.2.10)。
以下作品:
require 'active_record'
class My_Table < ActiveRecord::Base; end
My_Table.establish_connection connection_hash
My_Table.first
以下在同一会话中引发 ConnectionNotEstablished :
require 'active_record'
class My_Table < ActiveRecord::Base; end
My_Table.establish_connection connection_hash
My_Table.order(:some_column).first
作为一种解决方法,我正在提取所有此类记录并在 ruby 中进行排序,但这显然是错误的。我遗漏了一些明显的东西;它是什么?