【发布时间】:2017-01-21 01:29:53
【问题描述】:
我正在根据参数将用户重定向到应用程序的子域
respond_to do |format|
format.html { redirect_to home_url(subdomain: params[:company]), notice: "Couldn't able to process your request, please try after some time" }
end
带有通知消息,我将用户重定向到的 html 页面看起来像
<% flash.each do |name, msg| %>
<%= content_tag :div, msg, class: "alerts alerts-info bodyLeftPadd" %>
<% end %>
用于显示 Flash 消息。
但是这里的问题是没有显示通知消息。
是否使用子域导致此问题,因为如果删除子域并且如果我重定向到同一子域中的 url,我可以看到正在显示的 flash 消息。
respond_to do |format|
format.html { redirect_to home_url, notice: "Couldn't able to process your request, please try after some time" }
end
【问题讨论】:
-
如果你尝试
flash: { notice: "Couldn't able to process your request, please try after some time" }会怎样 -
@Andrey Deineko 是的,我也试过了,但没有显示消息。
-
尝试用
flash.each...注释掉你的部分——看看默认行为是否有效。你的代码看起来不错 -
@AndreyDeineko 感谢您的回复。我也尝试过相同的方法,但无法显示消息。
-
@AndreyDeineko 我做了一些编辑,你能看看吗
标签: html ruby-on-rails subdomain