authenticate_user 写帖子时出错 ruby-on-rails
authenticate_user error while writing posts ruby-on-rails
my code我做了一个应用程序,只有 authenticate_user 可以在 rails 上用 ruby 写 post。
但是我有个小问题
案例:如果未登录用户尝试访问 posts/new,我的应用程序重定向到 sign_in 路径非常好,但也会显示设备的错误消息。
我想隐藏这个错误
感谢阅读我的问题,祝大家有愉快的一天
在devise.en.yml
文件中删除错误信息,您需要将错误信息改为空白
en:
devise:
confirmations:
unauthenticated: "You need to sign in or sign up before continuing."
将unauthenticated
键的值更改为空白,如果用户尝试访问需要身份验证的页面,将不会显示失败消息。
unauthenticated: ""
希望对您有所帮助!
my code我做了一个应用程序,只有 authenticate_user 可以在 rails 上用 ruby 写 post。 但是我有个小问题
案例:如果未登录用户尝试访问 posts/new,我的应用程序重定向到 sign_in 路径非常好,但也会显示设备的错误消息。 我想隐藏这个错误
感谢阅读我的问题,祝大家有愉快的一天
在devise.en.yml
文件中删除错误信息,您需要将错误信息改为空白
en:
devise:
confirmations:
unauthenticated: "You need to sign in or sign up before continuing."
将unauthenticated
键的值更改为空白,如果用户尝试访问需要身份验证的页面,将不会显示失败消息。
unauthenticated: ""
希望对您有所帮助!