English 中文(简体)
3 控制台沙箱错误
原标题:Rails 3 Console Sandbox Error

新建至铁路, 我想使用 < em> 铁路控制台沙箱 < / em > 测试一些关联。 我创建了一个非常基本的应用程序, 并且 < em > 铁路控制台 < / em > 运作良好 。

我安装了活性支持宝石

当我运行 $ActionRecord::Base. configations[Rails.env][适配器] 命令时,它报告数据库是 sqlite3 (正确)。

但当我试图使用控制台的“ sandbox” 版本时, 我发现错误如下:

/Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:45:in `resolve_hash_connection : database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in `resolve_string_connection 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:23:in `spec 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:127:in `establish_connection 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/railtie.rb:76:in `block (2 levels) in <class:Railtie> 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:42:in `each 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/base.rb:721:in `<top (required)> 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/railtie.rb:41:in `block in <class:Railtie> 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie.rb:179:in `call 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie.rb:179:in `block in load_console 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie.rb:179:in `each 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie.rb:179:in `load_console 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:429:in `block in load_console 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/railties.rb:8:in `each 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application/railties.rb:8:in `all 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:429:in `load_console 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application.rb:153:in `load_console 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands/console.rb:27:in `start 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in `start 
from /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:41:in `<top (required)> 

我不知道这个错误告诉我什么, 因为我正确地设置了数据库. yml 文件, 并且用标准控制台将数据写入数据库。 我不知道如何解决这个问题 。

最佳回答

你应该把沙箱当作标语通过

rails c --sandbox

否则铁路就会认为沙箱是您想要运行控制台的环境。

问题回答

暂无回答




相关问题
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 ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

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?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

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

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 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签