0

Rails 给出 500 错误(在使用乘客的生产环境中)。生产日志说它缺少视图:

Started GET "/" for at 2012-05-12 20:34:18 +0200
Processing by EventCalendarsController#index as HTML
Completed 500 Internal Server Error in 18ms

ActionView::MissingTemplate (Missing template event_calendars/index, application/index with {:locale=>[:it], :formats=>[:html], :handlers=>[:erb, :builder]}. Searched in:
  * "/home/regroup/calendar/app/views"
  * "/home/regroup/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.0.4/app/views"
):
  app/controllers/event_calendars_controller.rb:24:in `index'

我确定bundle install安装了两者hamlhaml-rails宝石。这是我的 Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.3'

gem 'mysql2'
gem 'devise'
gem 'cancan'

# 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', :platform => :ruby

  gem 'uglifier', '>= 1.0.3'
  gem 'haml-rails'
  gem "twitter-bootstrap-rails"
end

gem 'jquery-rails'

这里有什么问题?我是否需要更改某些内容才能使其在生产环境中工作?

4

2 回答 2

3

尝试替换gem 'haml-rails'out of assets group 并将其放在 gem 'cancan'

于 2012-05-12T18:54:01.780 回答
2

根据Rails assets guide,bundler 中的资产组只能用于:

Gems 仅用于资产,默认情况下在生产环境中不需要。

您应该gem 'haml-rails'退出资产组。

于 2012-05-12T19:03:24.330 回答