2013-03-11 52 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