Skip to content

Commit 4f2e459

Browse files
committed
Merge pull request #324 from cerebris/model_name_error
Use NameError exception when model can not be resolved.
2 parents b41cbcc + 9100196 commit 4f2e459

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/jsonapi/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ def paginator(paginator)
623623
def _model_class
624624
return @model if @model
625625
@model = _model_name.to_s.safe_constantize
626-
fail "model could not be found for #{self.name}" if @model.nil?
626+
fail NameError, "model could not be found for #{self.name}" if @model.nil?
627627
@model
628628
end
629629

test/unit/resource/resource_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_model
5656
end
5757

5858
def test_nil_model_class
59-
error = assert_raises(StandardError) { NoMatchResource._model_class }
59+
error = assert_raises(NameError) { NoMatchResource._model_class }
6060
assert_equal(
6161
error.message,
6262
"model could not be found for NoMatchResource"

0 commit comments

Comments
 (0)