I have two APIs that I'm trying to mount in my Rails app-- one called 'v1' and another called 'twilio'. Each API will be composed of multiple files, so I want each to have its own folder. Inside my app/api directory, I have 2 folders--'v1' and 'twilio'--and a file called 'api.rb' that I am trying to use to mount the two api's. It's contents are:
module API
class V1 < Grape::API
prefix "api"
format :json
mount API::Root => '/v1'
end
class Twilio < Grape::API
prefix "twilio"
format :xml
mount API::Twilio_API => '/twilio'
end
end
In the 'v1' directory, I have a file called 'root.rb' that begins as follows:
module API
class Root < Grape::API
version 'v1', :using => :header
...
And in the 'twilio' directory, I have a file called 'twilio_api.rb' that begins as:
module API
class Twilio_API < Grape::API
version 'v1', :using => :header
...
My routes file has:
mount API::V1 => "/"
mount API::Twilio => "/"
When I start my rails server, I'm getting the error:
`load_missing_constant': Expected [My rails app]/app/api/v1/root.rb to define Root (LoadError)
I don't understand this, since root.rb certainly does define the Root class. Any help would be much appreciated.