mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Merge pull request #67 from te-chris/patch-1
@scope seems to be deprecated - updated the readme to reflect options[:s...
This commit is contained in:
commit
64cb68107a
@ -126,12 +126,12 @@ class PostSerializer < ActiveModel::Serializer
|
||||
|
||||
# only let the user see comments he created.
|
||||
def comments
|
||||
post.comments.where(:created_by => @scope)
|
||||
post.comments.where(:created_by => options[:scope])
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
In a serializer, `@scope` is the current authorization scope (usually
|
||||
In a serializer, `options[:scope]` is the current authorization scope (usually
|
||||
`current_user`), which the controller gives to the serializer when you call
|
||||
`render :json`
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user