Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3201c63
commit 2e31a14
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,8 @@ def initialize(object, options={}) | |
@meta_key = options[:meta_key] || :meta | ||
@meta = options[@meta_key] | ||
@wrap_in_array = options[:_wrap_in_array] | ||
@only = Array(options[:only]) if options[:only] | ||
@except = Array(options[:except]) if options[:except] | ||
This comment has been minimized.
Sorry, something went wrong. |
||
end | ||
attr_accessor :object, :scope, :root, :meta_key, :meta | ||
|
||
|
@@ -140,7 +142,13 @@ def associations | |
end | ||
|
||
def filter(keys) | ||
keys | ||
This comment has been minimized.
Sorry, something went wrong.
tchak
Contributor
|
||
if @only | ||
keys & @only | ||
elsif @except | ||
keys - @except | ||
else | ||
keys | ||
end | ||
end | ||
|
||
def embedded_in_root_associations | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Are these options passed to associations serializers?
For example, if I want to
?include=comments
, is there any way I can tell comments to include something? (contrived example)