Custom filters list applies only first filter
ruslankhaertdinov opened this issue · 2 comments
ruslankhaertdinov commented
Looks like in current implementation (ver. 0.5.0) only first filter from the custom_filters
list added to the @_allowed_custom_filters
. In this method elsif
condition doesn't work properly.
module JSONAPI::Utils::Support::Filter
module Custom
...
def custom_filter(attr)
attr = attr.to_sym
@_allowed_filters[attr] = {}
if !@_allowed_custom_filters.is_a?(Array)
@_allowed_custom_filters = Array(attr)
elsif @_allowed_custom_filters.include?(attr)
@_allowed_custom_filters.push(attr)
end
end
end
end
ruslankhaertdinov commented
@tiagopog Hi! Thanks a lot for so useful gem, and please take a look to this issue and related PR.
Thanks, Ruslan
tiagopog commented
You're right, it seems like there's a missing !
in the expression @_allowed_custom_filters.include?(attr)
. I'll take a look at the PR asap.