I'm pretty new to ruby, coming from a php background, but something is not clicking with me.
So, let's say I have a Ruby on Rails application and I am versioning my API like so:
app
|_controllers
|_api
| |_v1
| | |_application_controller.rb
| | |_user_controller.rb
| |_application_controller.rb
|_application_controller.rb
With the class structure with
# Versioned API V1 app controller
module Api
module V1
class ApplicationController
end
end
end
# Versioned API app controller
module Api
class ApplicationController
end
end
# Root app controller
class ApplicationController
end
#The code in question
module Api
module V1
class UserController < ApplicationController
end
end
end
So the question is, does ruby look for Api::V1::ApplicationController
, Api::ApplicationController
, or ApllicationController
for extending?
Does the < ApplicationController
look for it's own namespace unless I specify Api::ApplicationController
? If so, how do I specify the root one?