Closed simonc closed 7 years ago
Unfortunately you're yet another "victim" of relation inference. This is a feature that was removed from rom 4.0.0 (still in beta), because it bites people like in your case. What's happening here is that you defined classes after finalizing rom setup, which means rom doesn't know about your relation classes but in 3.x rom infers relations from the database schema automatically but it can't infer associations. Anyway, relation inference is gone in rom 4.0, so this won't happen again.
Please check out explicit setup docs to learn how to register your classes manually or use auto-registration feature.
@solnic Ok I see, I've been looking for this indication but sadly I skipped the explicit setup part thinking the info wouldn't appear in the "setup" part.
I think the Relations doc should include this line in at least one example. As of today it assumes that all the previous pages have been read and it rarely is the case. Devs have a tendency to muddle through things in my XP so it would make sense to hint here and there about registration, even if it means repeating the info. (DRY does not apply to docs 🙂)
Maybe you already addressed this issue in the 4.0.0. Otherwise I'm willing to open a PR in this direction.
Cheers ❤️
@simonc thanks for the feedback re docs, I totally agree with you. Before 4.0 final is released, we'll revamp the docs completely, it's one of the biggest tasks in this release, actually :)
@solnic awesome 😊
Hello,
I'm having an issue with the associations when defining my relations with classes.
Working example
Broken example
Additional details
My Gemfile contains the following:
I'm running with the following versions
Expected behavior
I would expect the second version to work the same way than the first one. Both versions are written in a single file. I didn't find anything indicating that I need to register something manually for the second version.
Is it a ROM bug or a misunderstanding of how things are supposed to work?
Thank you very much ❤️