How to render edit view and post flash message in rails3

前端 未结 3 424
说谎
说谎 2021-02-05 02:10

In my account controller I\'d like to display (render, redirect_to ?) the edit view after changes get saved and display flash notice.

 def update
    @account =         


        
3条回答
  •  时光说笑
    2021-02-05 02:38

    By default you have to use a separate statement, e.g.

    format.html { 
      flash[:notice] = 'message'
      render :edit
    }
    

    This ticket has a patch to let you use render 'edit', :notice => 'message'. It didn't get into Rails but there is a gem, flash_render, that adds it.

提交回复
热议问题