Skip to content

Commit

Permalink
Add doc for Rollbar.scope! method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon de Andres committed Feb 4, 2015
1 parent 0c5d2d5 commit 8be0a81
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ notifier = notifier.scope({
notifier.info('Jobs processed')
```

If you don't want to work with a new `Notifier` instance `#scoped` will do it for you:
If you don't want to work with a new `Notifier` instance `.scoped` will do it for you:

```ruby
while job
Expand All @@ -208,6 +208,21 @@ while job
end
```

It can be interesting changing the scope of the current notifier outside of any block. You can use `Rollbar.scope!` in those cases:

```ruby
class NotificationJob
include Sidekiq::Worker

def perform(user_id)
Rollbar.scope!(:person => { :id => :user_id })

Notification.send_to_user(user_id)
end
end
```


## Person tracking

Rollbar will send information about the current user (called a "person" in Rollbar parlance) along with each error report, when available. This works by calling the ```current_user``` controller method. The return value should be an object with an ```id``` method and, optionally, ```username``` and ```email``` methods.
Expand Down

0 comments on commit 8be0a81

Please sign in to comment.