2013-03-11 97 views
0

我遇到了一個問題,通過在rails 3.2.1中顯示flash:notice。在這裏我的代碼導軌3.2.1無法顯示Flash消息

class AssetsController < ApplicationController 
    before_filter :authenticate_user! 
    before_filter :user_can_upload, :only => [:new, :add_image] 
    #...actions 
    def new 
    @asset = Asset.new 
    respond_to do |format| 
    format.html # new.html.erb 
    format.json { render json: @asset } 
    end 
    end 

    private 
    def user_can_upload 
    if current_user.can_upload? 
     redirect_to dashboard_index_path, notice: I18n.t(:quota_assets) 
    end 
    end 
end 
在我的主要佈局

我有

%body 
= render 'layouts/shared/header' 
-if notice 
    .container 
    .alert.alert-success=raw notice 
= yield 

例如,在新的動作重定向工作正常,但顯示沒有通知消息。 任何提示? 謝謝

回答

1

我認爲如果你想輸出flash訊息,你必須使用flash[:notice]而不是notice