2015-11-15 52 views

回答

0

我假設您在創建新的Rails應用程序時使用了Rails的默認佈局,因此您將在app/views/layouts中有一個名爲application.haml的文件。然後,你可以把這段主體部分的最後一行:

= params 

所以application.haml應該是這樣的:

!!! 
%html 
    %head 
    %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/ 
    %title SMAC Challenge 
    = stylesheet_link_tag 'application', media: 'all' 
    = javascript_include_tag 'application' 
    = csrf_meta_tags 
    %body 
    = render partial: 'shared/nav_bar' 
    .container-fluid 
     .flash= render partial: 'shared/flash_message', flash: flash 
     .content 
     = yield 
     = render partial: 'shared/footer' 
    = params 

之後,這個佈局(application.haml)中呈現的所有頁面將在所有變量底端。