English 中文(简体)
主动记录:Connection NotEstablished差错(重负)
原标题:ActiveRecord::ConnectionNotEstablished error (eager loading?)

I m在OSX上发展,并在欧诺特部署。 我的环境是:

发展:

OSX Lion
Ruby 1.9.2p180
ActiveRecord 3.0.9
PostgreSQL 9.0

测试:

Ubuntu Server 11.04
Ruby 1.9.2p290
ActiveRecord 3.1.1
PostgreSQL 9.1

关于OSX但并非关于含水层的以下编码工作:

ei_doc_type = TaxDoc::Model::DocType.find_by_doc_type("EI")
doc_version = ei_doc_type.doc_versions.find_by_doc_version(edoc.version)
customer.electronic_invoices.create(....)

并且

ei_doc_type = TaxDoc::Model::DocType.find_by_doc_type("EI")
ei_doc_type.doc_versions.each { |doc_version|
  @mappings[doc_version.doc_version] = Hash.new
  doc_version.mappings.each { |mapping|
    @mappings[doc_version.doc_version][mapping.column_name] = mapping.xml_element
  }
}

当我试图将所有这些法典的一部分运用到LC,我发现以下错误:

.../connection_pool.rb:409: in `retrieve_connection : ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)

我修改了该守则,并在欧诺托开展工作:

ei_doc_type = TaxDoc::Model::DocType.find_by_doc_type("EI")
doc_versions = TaxDoc::Model::DocVersion.where(:doc_type_id => ei_doc_type.id, :doc_version => edoc.version)
doc_version = doc_version.first
customer.electronic_invoices.create(....)

并且

ei_doc_type = TaxDoc::Model::DocType.includes(:doc_versions => :mappings).find_by_doc_type("EI")
ei_doc_type.doc_versions.each { |doc_version|
  @mappings[doc_version.doc_version] = Hash.new
  doc_version.mappings.each { |mapping|
    @mappings[doc_version.doc_version][mapping.column_name] = mapping.xml_element
  }
}

看起来像急切地装上第一秩序协会,并不在试验环境中工作,第一个例子是。 即使我使用“包括”一词,也不可行。

积极记录或邮资的版本之间是否有不同可造成这种情况?

这些是我的模式:

class DocType < EDocsDatabase
  has_many :doc_versions, :dependent => :destroy
  has_many :mappings, :through => :doc_versions
  has_many :service_types
end

class DocVersion < EDocsDatabase
  belongs_to :doc_type
  has_many :mappings, :dependent => :destroy
end

class Mapping < EDocsDatabase
  belongs_to :doc_version
end
问题回答

你们在什么情况下使用该守则?

原因是——如果你在应急准备中操作你的代码(如服务器),目前需要一些联席管理。 铁路通过在你的主要申请答复者之外管理与你的联系的中间设备来解决这一问题。 然而,如果你没有这种包装,你可能会在您的连接库上有其他应用习惯,特别是在使用翻新服务器时。





相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签