Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Read type from column_type besides type for better supporting belongs_to #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lurodrigo
Copy link
Contributor

Following up on the discussion on #36

The PR intends to better support belongs_to.

To get the type, we first read column_type from opts, and only if it's not available we read type from opts. This way, we can use column_type everywhere if we want to, but we can also keep using type and not break existing code.

For belongs_to, the user can use belongs_to(:post, Post, type: TypeID) to use the default type for the column_type or specify it: belongs_to(:post, Post, type: TypeID, column_type: :string)

My comment here describes a reproducible example of the issue and its solution #36 (comment)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant