Remove left over references to scope instance variable

This commit is contained in:
vanstee 2012-05-16 22:47:52 -04:00
parent 56b61b1532
commit 81fddb55d3
3 changed files with 5 additions and 5 deletions

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`

View File

@ -91,7 +91,7 @@ module ActiveModel
# end
#
# def author?
# post.author == scope
# post.author == options[:scope]
# end
# end
#

View File

@ -71,8 +71,8 @@ class SerializerTest < ActiveModel::TestCase
end
class CommentSerializer
def initialize(comment, scope, options={})
@comment, @scope = comment, scope
def initialize(comment, options={})
@comment = comment
end
def serializable_hash