Missing devise routes helpers inside of rails engine views

devise, rails-engines, ruby-on-rails

Solution

Use

main_app.new_user_session_path

that should work

Problem

I'm building a Rails engine called Engrave. I have the engine mounted like so: ``` # Routes.rb of the host app mount Engrave::Engine => "/engrave", :as => "engrave_engine" ``` Within this engine I have a controller called "PostsController". When I navigate to this controller to view a post like so: `/engrave/posts/1` I get this error: ``` undefined local variable or method `new_user_session_path' ``` The PostsController in the engine is inheriting from the engine controller, which is inheriting from the application controller, like so: ``` module Engrave class PostsController < ApplicationController ... end class Engrave::ApplicationController < ApplicationController end ``` The new_user_session_path is being defined by devise, which I have setup like: ``` devise_for :users ``` The call to new_user_session_path is in the `layouts/application.html.erb` template file in the host app I cannot figure out why this route helper isn't available in this context. What am I doing wrong?

Original source

Related problems