Skip to content

Commit c34270c

Browse files
authored
feat(ruby): Add clarification on setting context in rails (#9459)
1 parent 866d36d commit c34270c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
```ruby
2+
Sentry.configure_scope do |scope|
3+
scope.set_context(
4+
'character',
5+
{
6+
name: 'Mighty Fighter',
7+
age: 19,
8+
attack_type: 'melee'
9+
}
10+
)
11+
end
12+
```
13+
14+
In Rails, the best place to do this is usually in a `before_action` hook in your controller or somewhere in your model logic.
15+
Any data set in `configure_scope` will be shared and isolated across a single request/response cycle.

0 commit comments

Comments
 (0)