即使在开发环境中,Rails环境看起来仍然停留在生产环境中

时间:2012-03-09 23:13:27

标签: ruby-on-rails bundler

当我在Rails应用程序目录中运行bundle install时,Bundler会安装仅在生产组中的gem(例如heroku或pg)。当我在本地运行rails服务器时,它也试图寻找在Google上有ZERO结果的activerecord-tcp-adapter:

/Users/atestu/.rvm/gems/ruby-1.9.3-p125@global/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require': Please install the tcp adapter: `gem install activerecord-tcp-adapter` (cannot load such file -- active_record/connection_adapters/tcp_adapter) (LoadError)

我认为这个gem与heroku的生产环境有关,但是我的RAILS_ENV变量是空的。当我将其设置为development或运行rails s -e development时,我会遇到完全相同的问题。

如何深入了解此问题?

编辑:这是我的Gemfile

source 'http://rubygems.org'

gem 'rails', '3.2.1'
gem 'json'
gem 'jquery-rails'
gem 'authlogic'
gem 'acts-as-taggable-on'
gem 'rpx_now'
gem 'hominid'
gem 'ruby-tmdb'
gem 'memcached'
gem 'aws-s3'

group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'uglifier'
end

group :production do
  gem 'heroku'
  gem 'pg'
end

group :development, :test do
  gem 'sqlite3'
  gem 'taps'
end

这是我的database.yml文件:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

3 个答案:

答案 0 :(得分:1)

也许你应该检查一下.bundle/config文件?

答案 1 :(得分:0)

Wierd ..可能与水龙头有关? Removing it from the Gemfile has helped others

它还没有在11个月内开发出来,当我将它包含在我的Gemfile中时,它生成了一个带有一堆宝石的ruby 1.9.1文件夹(我使用的是1.9.3) - 可能是一些冲突那里。似乎是我能找到的'tcp'的唯一参考。如果可能的话,可能值得使用pgbackups

您可能还想考虑使用Heroku toolbelt而不是将其包含在Gemfile中。

答案 2 :(得分:0)

更改database.yml:

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

 production:
  adapter: postgresql
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

您可以查看:https://devcenter.heroku.com/articles/sqlite3以获取更多信息

不要忘记将代码上传到GIT。