Skip to content

Commit 35ceb7f

Browse files
authored
belongs_to DSL alias - warning message updated
1 parent 6e95947 commit 35ceb7f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/jsonapi/resource.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,11 @@ def has_one(*attrs)
431431
end
432432

433433
def belongs_to(*attrs)
434-
# TODO: Add cool deprecation message here
434+
ActiveSupport::Deprecation.warn "In #{name} you exposed a `has_one` relationship "\
435+
" using the `belongs_to` class method. We think `has_one`" \
436+
" is more appropriate. If you know what you're doing," \
437+
" and don't want to see this warning again, override the" \
438+
" `belongs_to` class method on your resource."
435439
_add_relationship(Relationship::ToOne, *attrs)
436440
end
437441

0 commit comments

Comments
 (0)