@@ -4,7 +4,7 @@ module JSONAPI
44 module ActiveRelationRetrieval
55 include ::JSONAPI ::RelationRetrieval
66
7- def find_related_ids ( relationship , options = { } )
7+ def find_related_ids ( relationship , options )
88 self . class . find_related_fragments ( self , relationship , options ) . keys . collect { |rid | rid . id }
99 end
1010
@@ -17,7 +17,7 @@ module ClassMethods
1717 # @option options [Hash] :include_directives The `include_directives`
1818 #
1919 # @return [Array<Resource>] the Resource instances matching the filters, sorting and pagination rules.
20- def find ( filters , options = { } )
20+ def find ( filters , options )
2121 sort_criteria = options . fetch ( :sort_criteria ) { [ ] }
2222
2323 join_manager = ActiveRelation ::JoinManager . new ( resource_klass : self ,
@@ -41,7 +41,7 @@ def find(filters, options = {})
4141 # @option options [Hash] :context The context of the request, set in the controller
4242 #
4343 # @return [Integer] the count
44- def count ( filters , options = { } )
44+ def count ( filters , options )
4545 join_manager = ActiveRelation ::JoinManager . new ( resource_klass : self ,
4646 filters : filters )
4747
@@ -57,7 +57,7 @@ def count(filters, options = {})
5757 #
5858 # @param key the primary key of the resource to find
5959 # @option options [Hash] :context The context of the request, set in the controller
60- def find_by_key ( key , options = { } )
60+ def find_by_key ( key , options )
6161 record = find_record_by_key ( key , options )
6262 resource_for ( record , options [ :context ] )
6363 end
@@ -66,7 +66,7 @@ def find_by_key(key, options = {})
6666 #
6767 # @param keys [Array<key>] Array of primary keys to find resources for
6868 # @option options [Hash] :context The context of the request, set in the controller
69- def find_by_keys ( keys , options = { } )
69+ def find_by_keys ( keys , options )
7070 records = find_records_by_keys ( keys , options )
7171 resources_for ( records , options [ :context ] )
7272 end
@@ -76,7 +76,7 @@ def find_by_keys(keys, options = {})
7676 #
7777 # @param keys [Array<key>] Array of primary keys to find resources for
7878 # @option options [Hash] :context The context of the request, set in the controller
79- def find_to_populate_by_keys ( keys , options = { } )
79+ def find_to_populate_by_keys ( keys , options )
8080 records = records_for_populate ( options ) . where ( _primary_key => keys )
8181 resources_for ( records , options [ :context ] )
8282 end
@@ -93,7 +93,7 @@ def find_to_populate_by_keys(keys, options = {})
9393 # @return [Hash{ResourceIdentity => {identity: => ResourceIdentity, cache: cache_field}]
9494 # the ResourceInstances matching the filters, sorting, and pagination rules along with any request
9595 # additional_field values
96- def find_fragments ( filters , options = { } )
96+ def find_fragments ( filters , options )
9797 include_directives = options . fetch ( :include_directives , { } )
9898 resource_klass = self
9999
@@ -259,7 +259,7 @@ def find_fragments(filters, options = {})
259259 # @return [Hash{ResourceIdentity => {identity: => ResourceIdentity, cache: cache_field, related: {relationship_name: [] }}}]
260260 # the ResourceInstances matching the filters, sorting, and pagination rules along with any request
261261 # additional_field values
262- def find_related_fragments ( source_fragment , relationship , options = { } )
262+ def find_related_fragments ( source_fragment , relationship , options )
263263 if relationship . polymorphic? # && relationship.foreign_key_on == :self
264264 source_resource_klasses = if relationship . foreign_key_on == :self
265265 relationship . polymorphic_types . collect do |polymorphic_type |
@@ -498,11 +498,11 @@ def find_related_fragments_from_inverse(source, source_relationship, options, co
498498 #
499499 # @return [Integer] the count
500500
501- def count_related ( source , relationship , options = { } )
501+ def count_related ( source , relationship , options )
502502 relationship . resource_klass . count_related_from_inverse ( source , relationship , options )
503503 end
504504
505- def count_related_from_inverse ( source_resource , source_relationship , options = { } )
505+ def count_related_from_inverse ( source_resource , source_relationship , options )
506506 inverse_relationship = source_relationship . _inverse_relationship
507507 return -1 if inverse_relationship . blank?
508508
@@ -542,7 +542,7 @@ def count_related_from_inverse(source_resource, source_relationship, options = {
542542 # @option options [Hash] :context The context of the request, set in the controller
543543 #
544544 # @return [ActiveRecord::Relation]
545- def records_base ( _options = { } )
545+ def records_base ( _options )
546546 _model_class . all
547547 end
548548
@@ -552,7 +552,7 @@ def records_base(_options = {})
552552 # @option options [Hash] :context The context of the request, set in the controller
553553 #
554554 # @return [ActiveRecord::Relation]
555- def records ( options = { } )
555+ def records ( options )
556556 records_base ( options )
557557 end
558558
@@ -563,7 +563,7 @@ def records(options = {})
563563 # @option options [Hash] :context The context of the request, set in the controller
564564 #
565565 # @return [ActiveRecord::Relation]
566- def records_for_populate ( options = { } )
566+ def records_for_populate ( options )
567567 records_base ( options )
568568 end
569569
@@ -572,7 +572,7 @@ def records_for_populate(options = {})
572572 # @option options [Hash] :context The context of the request, set in the controller
573573 #
574574 # @return [ActiveRecord::Relation]
575- def records_for_source_to_related ( options = { } )
575+ def records_for_source_to_related ( options )
576576 records_base ( options )
577577 end
578578
@@ -637,13 +637,13 @@ def join_relationship(records:, relationship:, resource_type: nil, join_type: :i
637637
638638 # protected
639639
640- def find_record_by_key ( key , options = { } )
640+ def find_record_by_key ( key , options )
641641 record = apply_request_settings_to_records ( records : records ( options ) , primary_keys : key , options : options ) . first
642642 fail JSONAPI ::Exceptions ::RecordNotFound . new ( key ) if record . nil?
643643 record
644644 end
645645
646- def find_records_by_keys ( keys , options = { } )
646+ def find_records_by_keys ( keys , options )
647647 apply_request_settings_to_records ( records : records ( options ) , primary_keys : keys , options : options )
648648 end
649649
@@ -839,7 +839,7 @@ def quote(field)
839839 %{"#{ field . to_s } "}
840840 end
841841
842- def apply_filters ( records , filters , options = { } )
842+ def apply_filters ( records , filters , options )
843843 if filters
844844 filters . each do |filter , value |
845845 records = apply_filter ( records , filter , value , options )
@@ -865,7 +865,7 @@ def get_aliased_field(path_with_field, join_manager)
865865 concat_table_field ( table_alias , field_segment . delegated_field_name )
866866 end
867867
868- def apply_filter ( records , filter , value , options = { } )
868+ def apply_filter ( records , filter , value , options )
869869 strategy = _allowed_filters . fetch ( filter . to_sym , Hash . new ) [ :apply ]
870870
871871 if strategy
0 commit comments