Skip to content

Commit

Permalink
Merge pull request #800 from bwalex/readme_ar
Browse files Browse the repository at this point in the history
README - update for AR without Rails (see #517)
  • Loading branch information
dblock committed Nov 3, 2014
2 parents c9c0c1f + ff4f26c commit b7199a0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [Basic Usage](#basic-usage)
- [Mounting](#mounting)
- [Rack](#rack)
- [ActiveRecord without Rails](#activerecord-without-rails)
- [Alongside Sinatra (or other frameworks)](#alongside-sinatra-or-other-frameworks)
- [Rails](#rails)
- [Modules](#modules)
Expand Down Expand Up @@ -204,6 +205,20 @@ And would respond to the following routes:

Grape will also automatically respond to HEAD and OPTIONS for all GET, and just OPTIONS for all other routes.

### ActiveRecord without Rails

If you want to use ActiveRecord within Grape, you will need to make sure that ActiveRecord's connection pool
is handled correctly.

The easiest way to achieve that is by using ActiveRecord's `ConnectionManagement` middleware in your
`config.ru` before mounting Grape, e.g.:

```ruby
use ActiveRecord::ConnectionAdapters::ConnectionManagement

run Twitter::API
```

### Alongside Sinatra (or other frameworks)

If you wish to mount Grape alongside another Rack framework such as Sinatra, you can do so easily using
Expand Down

0 comments on commit b7199a0

Please sign in to comment.