Skip to content

Commit 78a8555

Browse files
gottfroislgebhardt
authored andcommitted
Removes ActiveRecord dependency for #model_hint
Class.name is the same as Class.to_s (cherry picked from commit bd55756)
1 parent 71a6e3f commit 78a8555

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

lib/jsonapi/resource.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,9 @@ def model_name(model, options = {})
539539
end
540540

541541
def model_hint(model: _model_name, resource: _type)
542-
model_name = ((model.is_a?(Class)) && (model < ActiveRecord::Base)) ? model.name : model
543542
resource_type = ((resource.is_a?(Class)) && (resource < JSONAPI::Resource)) ? resource._type : resource.to_s
544543

545-
_model_hints[model_name.to_s.gsub('::', '/').underscore] = resource_type.to_s
544+
_model_hints[model.to_s.gsub('::', '/').underscore] = resource_type.to_s
546545
end
547546

548547
def filters(*attrs)

0 commit comments

Comments
 (0)