Skip to content

Allow delegated_type to be specified primary_key and foreign_key#40865

Merged
rafaelfranca merged 1 commit intorails:masterfrom
gedorinku:gedorinku/delegated-type
Dec 18, 2020
Merged

Allow delegated_type to be specified primary_key and foreign_key#40865
rafaelfranca merged 1 commit intorails:masterfrom
gedorinku:gedorinku/delegated-type

Conversation

@gedorinku
Copy link

Summary

Since delegated_type assumes that the foreign_key ends with _id, singular_id defined by it does not work when the foreign_key does not end with id.
This PR fixes it by taking into account primary_key and foreign_key in the options.

Other Information

@gedorinku gedorinku marked this pull request as ready for review December 17, 2020 03:28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the documentation to reflect those new options?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it.

@gedorinku gedorinku force-pushed the gedorinku/delegated-type branch from d872d3a to d1b8c83 Compare December 18, 2020 03:24
Since delegated_type assumes that the foreign_key ends with `_id`,
`singular_id` defined by it does not work when the foreign_key does
not end with `id`. This commit fixes it by taking into account
`primary_key` and `foreign_key` in the options.
@gedorinku gedorinku force-pushed the gedorinku/delegated-type branch from d1b8c83 to 941c564 Compare December 18, 2020 06:06
@rafaelfranca rafaelfranca merged commit d133078 into rails:master Dec 18, 2020
@gedorinku gedorinku deleted the gedorinku/delegated-type branch December 19, 2020 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants