我使用HAML作为我的标记语言。 而我的视图只呈现自我视图,没有布局应用程序。如果我的方法我写Rails没有渲染标准的HAML布局
渲染:布局=>真
我会得到
有用于HomesController没有默认布局
/家/pavel/.rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/app/views]>
但是,如果我将application.html.haml重命名为application.html.erb,则一切正常。但脚手架产生HAML没有问题。怎么了?
class HomesController < ApplicationController
def index
@manufacturers = Manufacturer.all
#render :layout => 'application'
end
end
视图
%ul
- @manufacturers.each do |manufacturer|
%li
= link_to manufacturer.MFA_BRAND, vehiclemodel_url(:id => manufacturer.MFA_ID)
布局
!!!
%html
%head
%title Title
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
%body
- if current_user
= "Signed in as #{current_user.email}. Not you?"
= link_to "Sign out", logout_path
- else
= link_to "Sign in", new_user_session_path
%p
Hello!
%h4
=yield
当然,也有haml-rails – byCoder 2012-08-12 12:57:56
而且你在你改变Gemfile后立即运行'bundle install'? (对不起,如果这是一个明显的问题,但我得检查。) – depa 2012-08-12 13:13:16
是的!问题不在于此 – byCoder 2012-08-12 13:14:08