Skip to content

Commit d90ff46

Browse files
committed
Rename foreign_key_on :related_resource option to :related
1 parent 3d41deb commit d90ff46

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ The association methods support the following options:
247247
* `relation_name` - the name of the relation to use on the model. A lambda may be provided which allows conditional selection of the relation based on the context.
248248

249249
`has_one` associations support the additional option:
250-
* `foreign_key_on` - defaults to `:self`. To indicate that the foreign key is on the related resource specify `:related_resource`.
250+
* `foreign_key_on` - defaults to `:self`. To indicate that the foreign key is on the related resource specify `:related`.
251251

252252
Examples:
253253

test/fixtures/active_record.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,8 +1092,8 @@ module V5
10921092
class AuthorResource < JSONAPI::Resource
10931093
attributes :name, :email
10941094
model_name 'Person'
1095-
has_many :posts
1096-
has_one :author_detail, foreign_key_on: :related_resource
1095+
relationship :posts, to: :many
1096+
relationship :author_detail, to: :one, foreign_key_on: :related
10971097

10981098
filter :name
10991099

0 commit comments

Comments
 (0)