【发布时间】:2013-03-17 21:55:27
【问题描述】:
我使用的是 rails 3.2.12 版本,并且在我的视图中使用 .erb 模板。
现在我想开始使用haml模板。
我在 gem 文件中添加了 haml 和 haml-rails 并安装了包。
Using haml (4.0.0)
Installing haml-rails (0.4)
我已经做了一个模型application.html.haml
!!! 5
%html
%head
%title Rotten Potatoes!
= stylesheet_link_tag 'application'
= javascript_include_tag 'application'
= csrf_meta_tags
%body
= yield
然后我将 application_controller.rb 更改为
class ApplicationController < ActionController::Base
layout "application"
protect_from_forgery
include SessionsHelper
end
当我运行它时,我收到以下错误消息: 缺少带有 {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]} 的模板布局/应用程序。在以下位置搜索:*“/home/coen/Desktop/rails_project/sample_app/app/views”
好像没有安装haml处理程序。
我怎样才能做到这一点?
【问题讨论】:
标签: ruby-on-rails haml erb