LoginSignup
131
101

More than 5 years have passed since last update.

noticeやalertの設定方法の違い

Last updated at Posted at 2012-12-26
redirect_to foos_path, :notice => "Foo saved"

これでnoticeが表示されるので、

render :action => :new, :alert => "Some errors occured"

これも当然alertが表示されるだろう、と思いきや動作しない。
renderの場合はこのように書く必要があった。

flash.now[:alert] = "Some errors occured"
render :action => :new

ひっかけですね!!

NOTE: こちらの記事を参考にしました。

131
101
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
131
101