Skip to content

Commit bd55756

Browse files
authored
Removes ActiveRecord dependency for #model_hint
Class.name is the same as Class.to_s
1 parent 3b1d574 commit bd55756

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
@@ -550,10 +550,9 @@ def model_name(model, options = {})
550550
end
551551

552552
def model_hint(model: _model_name, resource: _type)
553-
model_name = ((model.is_a?(Class)) && (model < ActiveRecord::Base)) ? model.name : model
554553
resource_type = ((resource.is_a?(Class)) && (resource < JSONAPI::Resource)) ? resource._type : resource.to_s
555554

556-
_model_hints[model_name.to_s.gsub('::', '/').underscore] = resource_type.to_s
555+
_model_hints[model.to_s.gsub('::', '/').underscore] = resource_type.to_s
557556
end
558557

559558
def filters(*attrs)

0 commit comments

Comments
 (0)