mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Merge pull request #183 from kevins90/update_readme_associations
Update association section on README.md
This commit is contained in:
@@ -290,7 +290,7 @@ class PostSerializer < ActiveModel::Serializer
|
||||
|
||||
# only let the user see comments he created.
|
||||
def comments
|
||||
post.comments.where(:created_by => scope)
|
||||
object.comments.where(:created_by => scope)
|
||||
end
|
||||
end
|
||||
```
|
||||
@@ -317,7 +317,7 @@ class PostSerializer < ActiveModel::Serializer
|
||||
has_many :comments
|
||||
|
||||
def include_comments?
|
||||
!post.comments_disabled?
|
||||
!object.comments_disabled?
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user