Skip to content

Commit 55f9ae5

Browse files
Ruslan Khaertdinovtiagopog
authored andcommitted
Fix custom filters assignment (#48)
1 parent f48999f commit 55f9ae5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/jsonapi/utils/support/filter/custom.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ def custom_filters(*attrs)
1111
def custom_filter(attr)
1212
attr = attr.to_sym
1313
@_allowed_filters[attr] = {}
14-
15-
if !@_allowed_custom_filters.is_a?(Array)
16-
@_allowed_custom_filters = Array(attr)
17-
elsif @_allowed_custom_filters.include?(attr)
18-
@_allowed_custom_filters.push(attr)
19-
end
14+
@_allowed_custom_filters ||= []
15+
@_allowed_custom_filters |= [attr]
2016
end
2117
end
2218
end

0 commit comments

Comments
 (0)