I'm following a tutorial on Dookeeper and Devise gems in Rails, in one point of the video, the author creates the following routes:
namespace :api do
namespace :v1 do
resources:books
end
end
scope :api do
scope :v1 do
use doorkeeper do
skip_controllers:authorizations,:applications,:authorized_applications
end
end
end
I don't quite understand what's the point of the namespace and scope in point... They complement each other or are separated things and why do I have to use?
Thanks a lot!
Here's a helpful overview.
In short (my emphasis added):
So
scopeis useful for making a route matchnamespacewhen there aren't controllers with matching names.Gives you a base route of "/api/v1/books" but requires a
Api::V1::BooksControllerGives doorkeeper routes that start with "api/v1" but without trying to match to an
Api::V1::Doorkeeperclass.