How to render edit view and post flash message in rails3

前端 未结 3 436
说谎
说谎 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:32

    You can still use notices like in Rails 2:

    flash[:notice] = "message"
    

    Just add the following line to the top of your view to display it:

    <%= flash[:notice] %>

    And you should use render method if you don't want to make your users to fill edit forms once again.

提交回复
热议问题