2013-03-17 117 views
2

我正在使用rails版本3.2.12,并为我的视图使用.erb模板。application.html.haml未呈现

现在我想开始使用haml模板。

我将haml和haml-rails添加到gem文件并安装了该软件包。

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处理程序没有安装。

我该如何做到这一点?

回答

2

那么,你有没有重新启动你的开发服务器?在Gemfile中添加一个gem后,这是非常重要的事情。

顺便说一句。我一直使用哈姆,我从未使用过“haml-rails”。

当我开始新鲜的项目时,我所做的唯一事情就是将“gem'haml'”添加到Gemfile中,并且所有工作都像它应该工作一样。

+0

阿嘎,我讨厌它什么时候可以想到自己的答案:) 感谢一个捆绑队友! – MPL 2013-03-17 22:52:30