2012-12-28 34 views
0

我試圖使用另一種功能/方法來重定向&輸出通知,但它沒有奏效。它在自己的功能內正常工作。無法從另一種方法輸出閃光信息

def delete_sb 
    # @sb = SasaranBaru.find(params[:id]) 
    # @sb.destroy 
    flash[:notice] = "fffff" 
    render_group("flash msg") 
    end 

    def render_group(notice) 
    logger.debug notice 
    flash[:notice] = notice 
    if params[:filter] 
     filter = prepare_filter_query(params[:filter]) 
     redirect_to "/groups?#{filter.to_query}", notice: 'okokoko okokokok ' 
    else 
     redirect_to "/groups", notice: 'hehehehe eheheheh' 
    end 
    end 

在我看來沒有閃光值。

回答

1

這段代碼之後有重定向嗎?閃光燈僅對一個請求有效,然後消失。測試這個

一種方法是使用:

flash.keep[:notice]='ffffff' 

,看看有沒有顯示出來,但我懷疑你是通過另一個控制器將在/group並再次重定向,失去閃光燈。

+0

omg你是對的。 theres是另一個重定向。我在調試中錯過了一個紅色的請求 –

相關問題