Uninitialized constant inside controller namespace

Viewed 584

I'm trying to solve the following issue but I just can't get my head around the autoloading in Rails yet. I have the following controller located in app/api/v1/registration_controller.

class Api::V1::RegistrationController < ApplicationController
   include ::Foo::Bar

   def index
   end
 end

And the following module/class in app/foo/bar.rb:

module Foo
  class Bar
     def some_method
     end
  end
end

However, I'm getting the following error message:

uninitialized constant Foo

I'm trying to get my head around this and already searched Stack Overflow for solutions, but I wasn't able to find the right one. If the solution is already written down elsewhere, please close this topic.

Hopefully someone can help me. Thanks!

1 Answers
Related