I have an engine related rails issue.

I have two engines, of which one is mounted.

   1. FooEngine
   2. BarEngine (mounted at: "/bar")

I have three controllers:

class FooEngine::SessionsController < BarEngine::ApplicationController
  def new; endend
class BarEngine::ApplicationController < ActionController::Base
  def welcome; endend
class BarEngine::SessionsController < FooEngine::SessionsControllerend

In my BarEngine routes file:

BarEngine::Engine.routes.draw do
  root to: "application#welcome"
  resources :sessions, only: [:new]end

For some reason, the view context is not what I expect it to be when I go 
to "/bar/sessions/new". I would expect to have access to "root_path" for 
instance, but I do not. I need to use "bar.root_path". E.g.

class BarEngine::SessionsController < FooEngine::SessionsController
  def new
    view_context.root_path     # does not work
    view_context.bar.root_path # works
  endend

This is surprising to me because BarEngine::SessionsController inherits 
from FooEngine::SessionsController which inherits from 
BarEngine::ApplicationController. It seems I'm somehow in the wrong scope 
inside BarEngine::SessionsController.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/37a85cc5-ba04-4d56-901b-eb46bcf9ae43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to