1
votes

I have a module ApiHelper in the helpers api_helper folder that's causing a bit of mayhem. In controllers/api/v1 I have two controllers, both of which have

include ApiHelper

The exact error is:

/Users/WEF6/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:461:in `load_missing_constant': Circular dependency detected while autoloading constant APIHelper (RuntimeError)

I'm thinking this issue is happening because I have an api_controller that is set up like this using rails-api:

class ApiController < ActionController::API

and my normal application controller set up like this

class ApplicationController < ActionController::Base

The api controllers inherit from the ApiController, while my normal App controllers inherit from the ApplicationController.

Or it might be something much more simple; thoughts?

1
Did you managed to solve this?Sebastian Osuna
No, I ended up moving the methods I wanted to be helpers into separate modules and put them in the concerns folder. Examples are the module Presentable, Decryptable, and Parsable.Morgan
In my case it was a helper called TableHelper just changed the name to MyTableHelper and all was good.Sebastian Osuna

1 Answers

0
votes

I know this is old, but I ran into a similar problem recently. In my case the problem was the addition of an inflection acronym for 'API' to config/initializers/inflections.rb.

All I had to do to solve this was to rename ApiHelper to APIHelper and the problem was solved.