活动管理 - 闪现消息未出现在页面上
我试图在重定向到页面后显示通知,但它没有出现。
这是重定向 -
redirect_to :action => :index, :notice => "My redirect"
您可以在网址中看到该消息,但活动管理中似乎没有任何代码来显示它。
有什么想法如何在活动管理中呈现它吗?
I am trying to display a notice after redirecting to a page but it doesnt appear.
Here is the redirect -
redirect_to :action => :index, :notice => "My redirect"
You can see the message in the url but there doesnt seem to be any code inside active admin to display it.
Any ideas how to render it inside active admin ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎有一些问题我还没有找到,但如果您在那之前正在寻找解决方法,这就是我所做的:
我看到的问题是当您输入
:notice
在redirect_to
方法中,通知消息经过url编码并添加到URL结果中,
效果不太理想。我注意到对 active_admin 文档进行了更改,其中包括将
{}
放在redirect_to
的第一个参数周围以解决此问题,但是,对我来说,这会导致错误。这导致
我在 github 上的 active_admin on github 发布了对该特定拉取请求的评论,希望有人可能还有另一个建议,因为我很困惑。
无论如何,也许这些解决方案之一适合您。祝你好运。
There seems to be some issue that I haven't tracked down yet, but if you are looking for a work-around until then, this is what I did:
The problem that I am seeing is that when you put
:notice
in theredirect_to
method, the notice message is url encoded and added to the URLresults in
which is less than ideal. I noticed a change to the active_admin documentation that includes putting
{}
around the first parameter toredirect_to
to fix this problem, however, for me, this results in an error.which results in
I posted a comment on that particular pull request @ active_admin on github and hopefully someone might have another suggestion, since I am stumped.
In any event, maybe one of these solutions will work for you. Good luck.
Active Admin 不会呈现 Flash 消息,它认为它们是在布局中呈现的。
当您运行 active_admin:install 生成器时,它提到:
Active Admin doesn't render flash messages, it believes they are rendered in t layout renders them.
When you run active_admin:install generator it mentions that: