File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
lib/active_model/serializer Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ def associations(include_tree = DEFAULT_INCLUDE_TREE)
88
88
89
89
Enumerator . new do |y |
90
90
self . class . _reflections . each do |reflection |
91
- next unless reflection . included ?( self )
91
+ next if reflection . excluded ?( self )
92
92
key = reflection . options . fetch ( :key , reflection . name )
93
93
next unless include_tree . key? ( key )
94
94
y . yield reflection . build_association ( self , instance_options )
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ module Attributes
17
17
def attributes ( requested_attrs = nil , reload = false )
18
18
@attributes = nil if reload
19
19
@attributes ||= self . class . _attributes_data . each_with_object ( { } ) do |( key , attr ) , hash |
20
- next unless attr . included ?( self )
20
+ next if attr . excluded ?( self )
21
21
next unless requested_attrs . nil? || requested_attrs . include? ( key )
22
22
hash [ key ] = attr . value ( self )
23
23
end
Original file line number Diff line number Diff line change @@ -24,14 +24,14 @@ def value(serializer)
24
24
#
25
25
# @api private
26
26
#
27
- def included ?( serializer )
27
+ def excluded ?( serializer )
28
28
case condition_type
29
29
when :if
30
- serializer . public_send ( condition )
31
- when :unless
32
30
!serializer . public_send ( condition )
31
+ when :unless
32
+ serializer . public_send ( condition )
33
33
else
34
- true
34
+ false
35
35
end
36
36
end
37
37
You can’t perform that action at this time.
0 commit comments