Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Signed-off-by: Eugie Limpin <[email protected]>
  • Loading branch information
eugiellimpin committed Feb 2, 2016
1 parent e686f72 commit 15f9ff8
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,30 @@ Or install it yourself as:

## Usage

Mount `RealIp` rack middleware at the top of your Rack application's middleware stack.
1. Mount `RealIp` rack middleware at the top of your Rack application's middleware stack.

Rack (config.ru)
Rack (`config.ru`)

```ruby
require 'real_ip'
use RealIp
```
```ruby
require 'real_ip'
use RealIp
```

Rails (config/application.rb or config/environments/*.rb)
Rails (`config/application.rb` or `config/environments/*.rb`)

```ruby
module MyApp
class Application < Rails::Application
```ruby
module MyApp
class Application < Rails::Application
config.middleware.insert 0, 'RealIp'
end
end

MyApp::Application.configure do
config.middleware.insert 0, 'RealIp'
end
end
```

MyApp::Application.configure do
config.middleware.insert 0, 'RealIp'
end
```
2. On your controller, use `request.env['QUIPPER_REMOTE_ADDR']` to get the IP address

## Contributing

Expand Down

0 comments on commit 15f9ff8

Please sign in to comment.