首先,我对Rails不太了解。我正在制作一个博客应用程序,当尝试在生产环境中运行它时,两种方法都出现了问题:
rails s -e production
和
RAILS_ENV=production
我遇到了相同的错误:
=> 启动 WEBrick => Rails 3.2.8 应用正在以生产模式启动,访问地址为 http://0.0.0.0:3000
=> 使用 -d 参数可以将进程转入后台
=> 使用 Ctrl-C 可以关闭服务器
退出
/home/loku/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-> resolve_hash_connection': 数据库配置没有指定适配器 (ActiveRecord::AdapterNotSpecified)
...
我的设置:
ruby 1.9.3p286 (2012-10-12 revision 37165) [i686-linux]
Rails 3.2.8
数据库配置文件 database.yml:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: blogg_development
pool: 5
timeout: 5000
username: root
password: ***
host: localhost
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: blogg_production
pool: 5
timeout: 5000
username: root
password: ***
host: localhost
Gemfile:
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'haml-rails'
gem 'less-rails'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap- rails.git'
#gem 'actionpack', '~> 3.1.0'
end
gem 'jquery-rails'
gem 'haml'
gem 'devise'
gem 'cancan'
group :test, :development do
gem 'guard-livereload'
gem 'rb-fsevent'
gem 'pry'
gem 'pry-rails'
end
group :linux do
gem 'libnotify'
end
group :darwin do
gem 'rb-fsevent', require: false
gem 'growl'
end