我已经开始了一个新的rails应用程序并将模板引擎从erb转换为haml.我在ham解析器中添加了Gemfile,运行bundle install,删除了app/views/layout/application.html.erb文件,并将其替换为haml等效文件.我没有收到任何错误消息,其他haml视图在浏览器中正确呈现,但application.html.haml中的内容被忽略:如果我查看生成页面的来源,他们会错过来自application.html.haml的标记,任何关于我应该看哪里的想法?
application.html.haml
!!! 5
%html
%head
%title Title
= stylesheet_link_tag 'application'
= javascript_include_tag 'application'
= csrf_meta_tags
%body
%h1.title Title
#main
- if flash[:notice]
#notice.message= flash[:notice]
- elsif flash[:warning]
#warning.message= flash[:warning]
= yield
Run Code Online (Sandbox Code Playgroud)
的Gemfile
source 'http://rubygems.org'
gem 'rails', '3.1.0'
gem 'sqlite3'
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
gem 'therubyracer'
end
gem 'jquery-rails'
gem 'haml'
group :development, :test do
gem 'ruby-debug19'
end
Run Code Online (Sandbox Code Playgroud)