intridea/grape — pull request #612 by edelgado (2014-04-03 19:29:20+00:00)
Title: Clarified the code structure for Rails.

I ran into an issue running a very simple Grape API within a Rails 4 application that has to do with the directory structure in Rails.

It wasn't clear to me in http://intridea.github.io/grape/docs/index.html#Rails, that underneath the `app/api` directory, you need to create yet another subdirectory which name matches the name of the module that implements the Grape API.

For example, if your API is implemented in a file called `api.rb` as:

```ruby
module Twitter
class API < Grape::API
version 'v1', using: :path
format :json

resource :statuses do
desc "Return a public timeline."
get :public_timeline do
Status.limit(20)
end
end
end
end
```
The file `api.rb` needs to live in `app/api/twitter/api.rb`, otherwise, Rails does not recognize the name of the module and throws the following error when trying to run the rails server:

`/config/routes.rb:[line number]:in `block in ': uninitialized constant Twitter (NameError)`