Приложение не запустится в производственном режиме с config.cache_classes, установленным в true.Это приводит к следующей ошибке с помощью трассировки стека:
$ bundle exec rails s -e production
/home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:304:in `rescue in depend_on': No such file to load -- /path-to-app/app/config/environment (LoadError)
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:299:in `depend_on'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:216:in `require_dependency'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:138:in `block (2 levels) in eager_load!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:137:in `each'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:137:in `block in eager_load!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:135:in `each'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:135:in `eager_load!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:108:in `eager_load!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `instance_exec'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `run'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `each'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `run_initializers'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:134:in `initialize!'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
from /path-to-app/config/environment.rb:5:in `<top (required)>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /path-to-app/config.ru:3:in `block in <main>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /path-to-app/config.ru:1:in `new'
from /path-to-app/config.ru:1:in `<main>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:35:in `eval'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:35:in `parse_file'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:162:in `app'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:253:in `wrapped_app'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:204:in `start'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands/server.rb:65:in `start'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /home/vipin/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Странно, но при отключенном кэшировании работает нормально.Мой файл production.rb выглядит как
App::Application.configure do
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_dispatch.x_sendfile_header = "X-Sendfile"
config.action_mailer.delivery_method = :sendmail
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.serve_static_assets = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.action_dispatch.best_standards_support = :builtin
end
Я использую следующие драгоценные камни:
source 'http://rubygems.org'
gem 'rails', '3.0.7'
gem 'mysql2', '0.2.1'
gem 'carrierwave'
gem 'rmagick'
gem "capistrano-ext"
gem 'rake', '0.8.7'
group :development do
gem 'rspec-rails', '2.1.0'
gem 'ruby-debug19'
gem 'wirble'
end
group :test do
gem 'ruby-debug19'
gem 'rspec', '2.1.0'
gem 'webrat', '0.7.1'
gem 'factory_girl_rails', '1.0'
end
gem 'thinking-sphinx', '2.0.3'
Я очень ценю любую помощь