I want to do an API for an Android app. When searching, I found {grape}. I\'m following this tutorial, but I have a problem launching the Rails server:
=> Boo
Try either
Moving your API code's files from app/api
to app/api/api
, or
Moving your API classes outside the API
module (i.e. deleting all the module API
lines and their corresponding end
statements).
From Grape's documentation:
Place API files into
app/api
. Rails expects a subdirectory that matches the name of the Ruby module and a file name that matches the name of the class. In our example, the file name location and directory forTwitter::API
should beapp/api/twitter/api.rb
.
Thus the correct location for your API::Root
class would actually be app/api/api/root.rb
.
With this change your code starts and works fine for me on Rails 4.0.2.