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