简体   繁体   中英

Using Devise in a Mountable Engine Rails from outside of the engine

I have an engine called hq_core, and I have another rails app called hq.

hq_core has a devise user installed within it and it works perfectly from hq. I did this using this how-to

I want to create a devise admin_user that is only in hq, not hq_core. I ran the typical 'rails g devise admin_user' which installed find in hq.

But when I hit localhost:3000/admin_users/sign_in, it says

ActionView::Template::Error (undefined method `admin_user_session_path' for #<ActionDispatch::Routing::RoutesProxy:0x007fb454403818>):

This is a rails 4 application with Devise 3.0.0rc

I just had the same problem which I solved by adding

Devise.setup do |config|
  config.router_name = :<your engine name here>
end

to my config/initializers/devise.rb as stated in the how to.

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