Skip to content

Commit c9e21fd

Browse files
Fixing cops
1 parent b36a49a commit c9e21fd

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/jsonapi/scopes/sorts.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ def sortable_fields(*fields)
2121
def apply_sort(params = {}, options = { allowed: [], default: {} })
2222
fields = params.dig(:sort)
2323

24-
allowed_fields = Array.wrap(options[:allowed]).presence || @sortable_fields
25-
allowed_fields = allowed_fields.map(&:to_sym)
26-
27-
default_order = options[:default].presence || @default_sort
28-
default_order = default_order.transform_keys(&:to_sym)
29-
24+
allowed_fields = (Array.wrap(options[:allowed]).presence || @sortable_fields).map(&:to_sym)
25+
default_order = (options[:default].presence || @default_sort).transform_keys(&:to_sym)
3026
ordered_fields = convert_to_ordered_hash(fields)
3127

3228
ordered_fields.each do |field, _|

0 commit comments

Comments
 (0)