简体   繁体   中英

undefined method `user_session_path' using devise in rails engine

I am developing a rails engine.

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. 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). I was trying to

user_session_path

Instead it should've been

EngineName::Engine.routes.url_helpers.user_session_path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM