How to display a Rails flash notice upon redirect?

后端 未结 6 1257
天命终不由人
天命终不由人 2021-01-31 01:21

I have the following code in a Rails controller:

flash.now[:notice] = \'Successfully checked in\'
redirect_to check_in_path

Then in the /check_

6条回答
  •  醉话见心
    2021-01-31 01:48

    I had the same problem, and your question solved mine, because I had forgotten to include in the /check_in view:

    <%= notice %>

    In the controller, just a single line:

    redirect_to check_in_path, :notice => "Successfully checked in"             
    

提交回复
热议问题