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:
Yehuda Katz 2012-06-05 00:23:50 -07:00
commit 64cb68107a

View File

@ -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`