我实现了这个解决方案
然而,在那之后,设备的闪光消息不起作用,我已经尝试删除此行flash.clear,但仍然没有显示闪光消息。
# ../controllers/concerns/accessible.rb
module Accessible
extend ActiveSupport::Concern
included do
before_action :check_user
end
protected
def check_user
flash.clear
if current_tenant
redirect_to(authenticated_tenant_root_p
在发送表单后,我将处理表单中的数据,并希望将操作呈现为JS。这对我很有用。但+此功能,我想添加一个闪光消息。我试着这样做:
respond_to do |format|
if @save.update_attributes(params[:data])
format.js {
flash[:notice] = 'The article was successfully updated.'
render :update do |page|; page << "$('#my_div').html