简体   繁体   English

在 Rails 引擎中使用设计的未定义方法“user_session_path”

[英]undefined method `user_session_path' using devise in rails engine

I am developing a rails engine.我正在开发一个 Rails 引擎。

This is an excerpt from my routes file:这是我的路由文件的摘录:

devise_for :users, class_name: "Subscribem::User", controllers: { sessions: 'devise/sessions', passwords: 'devise/passwords', registrations: 'devise/registrations' }

These are my session routes:这些是我的会话路线:

    new_user_session GET      /users/sign_in(.:format)               devise/sessions#new
        user_session POST     /users/sign_in(.:format)               devise/sessions#create

When I use any link like this:当我使用任何这样的链接时:

= link_to "Login", new_user_session_path

Then I retrieve the "undefined method `user_session_path'" error.然后我检索“未定义的方法`user_session_path'”错误。 My engine also has isolated namespaces and I can't figure out the problem.我的引擎也有独立的命名空间,我无法弄清楚问题所在。

any help would be appreciated.任何帮助,将不胜感激。

The same thing happens to me in a devise is inside of the mountable engine(rails 6.0.3.1).同样的事情发生在我身上的可安装引擎内部(rails 6.0.3.1)。 I was trying to我试图

user_session_path

Instead it should've been相反,它应该是

EngineName::Engine.routes.url_helpers.user_session_path

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 redirect_to内部视图-RAILS-DEVISE重定向到user_session_path - redirect_to inside view - RAILS - DEVISE redirect to user_session_path 如何在设计中使自定义表单提交到user_session_path - How to make a custom form submit to the user_session_path in devise 可安装引擎中的Devise + Omniauth:未定义方法`user_omniauth_authorize_path' - Devise + Omniauth in a mountable engine : undefined method `user_omniauth_authorize_path' Ruby on Rails - 设计注册链接无效 - 未定义方法`user_registration_path' - Ruby on Rails - Devise sign up link not working - undefined method `user_registration_path' Rails Devise 来自 wiki 的文章抛出错误:未定义的局部变量或方法 `authenticated_user_root_path' - Rails Devise Article from wiki throws error: undefined local variable or method `authenticated_user_root_path' 在Rails中使用devise时的未定义方法 - Undefined method when using devise in rails Devise + Omniauth =未定义的方法“ new_session_path” - Devise + Omniauth = undefined method `new_session_path' 无法以表格形式显示用户数据,得到未定义的方法“ user_path”(使用devise和simple_form) - Not able to show user data in form, getting undefined method `user_path' (Using devise and simple_form) 用户的未定义方法“设计” - undefined method 'devise' for User 轨道为未定义的方法“ subdomain”设计after_sign_up_path_ - rails devise after_sign_up_path_for undefined method `subdomain'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM