radar/forem — Issue #157: "stack level too deep" error when calling Forem route helper from main app
Author: impact11
Created: 2012-02-22 04:03:12+00:00
State: open

I have a Rails 3.1 app, using sorcery as an authentication system. I have Forem installed as an engine loaded into my Rails app, stored in the lib/forem directory.

Forem loads beautifully, runs well.

When I include named route helpers in partials that are used by the Forem layouts, using main_app.user_path(id) works beautifully.

However, when I try to use forem helpers within the rest of my app (e.g. forem.admin_root_path ), not only do I not get paths, it causes my server's CPU usage to go through the roof, while it cranks for a few seconds, and then I get an error page.
```ruby

SystemStackError in Groups#show
stack level too deep
```

This happens for any attempt to generate a forum url from within the context of my main app.

When I'm within a Forem-rendered page, those helpers work beautifully.
When I'm within a page rendered by my app, those helpers fail.

My apps routes.rb file includes
```ruby
mount Forem::Engine => "/forums"
```
at the bottom of the file.

I have no routes in my app that conflict with any of the named routes in Forem.

If I manually type in the corresponding URLs, everything works fine.

There seems to be something about the way either Rails or Forem handles the request for the Engine's routes mapping that gets into some kind of endless or recursive loop.

Does anyone have any ideas as to where I may start looking?