Rails正在搜索.erb视图而不是.haml

时间:2012-05-12 18:52:49

标签: ruby-on-rails ruby-on-rails-3.2

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

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'

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

2 个答案:

答案 0 :(得分:3)

尝试替换资产组中的gem 'haml-rails'并将其放在gem 'cancan'

答案 1 :(得分:2)

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

  

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

您应该从资产组中取出gem 'haml-rails'