2013-03-17 115 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