Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

No longer generate belongs_to relationships when using references in the new generators #2151

Closed
josevalim opened this issue Mar 4, 2017 · 6 comments

Comments

@josevalim
Copy link
Member

Because there is a higher chance we will get the wrong module name now and because we may end-up accidentally pushing developers to have associations across contexts.

@chrismccord, what do you think?

@chrismccord
Copy link
Member

I think this is the way to go, but I would continue to generate the belongs_to provided the context already exists and the assoc'd schema lives inside it. Yay/nay?

@josevalim
Copy link
Member Author

@chrismccord it is slightly tricky to detect but we can try. The problem is that users in the past were used to write:

post_id:references:posts

But now they need to write:

post_id:references:blog_posts

So we need to figure out if the underscored context is a prefix of "blog_posts". It is definitely possible but it looks iffy.

@chrismccord
Copy link
Member

ah I see. 👍 to not generating belongs_to for now

@josevalim
Copy link
Member Author

Fixed in master.

@dustinfarris
Copy link

Specifying blog_posts makes perfect sense to me. Former Django dev here and this all makes me feel right at home.

@sobolevn
Copy link

Was confused a lot by missing belongs_to at first.

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

No branches or pull requests

4 participants