We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent df16278 commit b274613Copy full SHA for b274613
2 files changed
lib/jsonapi/resource.rb
@@ -429,6 +429,7 @@ def relationship(*attrs)
429
def has_one(*attrs)
430
_add_relationship(Relationship::ToOne, *attrs)
431
end
432
+ alias_method :belongs_to, :has_one
433
434
def has_many(*attrs)
435
_add_relationship(Relationship::ToMany, *attrs)
test/unit/jsonapi_request/jsonapi_request_test.rb
@@ -4,7 +4,7 @@ class CatResource < JSONAPI::Resource
4
attribute :name
5
attribute :breed
6
7
- has_one :mother, class_name: 'Cat'
+ belongs_to :mother, class_name: 'Cat'
8
has_one :father, class_name: 'Cat'
9
10
filters :name
0 commit comments