Accessing rails flash[:notice] in a model

后端 未结 2 1003
無奈伤痛
無奈伤痛 2020-12-14 11:39

I am trying to assign a message to flash[:notice] in a model observer.

This question has already been asked: Ruby on Rails: Observers and flash[:notice] messages?

2条回答
  •  误落风尘
    2020-12-14 12:11

    No, you set it in the controller where the saving is occurring. flash is a method defined on ActionController::Base.

提交回复
热议问题