wolfiton
Hi everyone,
What naming convention would you use to create associations when you use generators like this:
mix phx.gen.context Blog Post posts title body
Then you have a many-to-many with Tags
mix phx.gen.context Blog Tag tags name description
mix ecto.gen.migration create_tags_posts for the join through
Because the docs confuse me a little on best practices and clarity Ecto Association Guide – Ecto v2.2.11 especially this part EctoAssoc.Post
Do you rename the schema in TagsPosts or how do you name this relationship?
Thanks
Trending in Chat/Questions
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kokolegorille
I use plural form in alphabetical order, but it’s just by convention… You can use whatever name You want.
So in this case, I would use posts_tags.
wolfiton
So you have to create a new
Schema with changesetthat matches thismigrationorthe post and tag schemashould take care of it using the many-to-many relationship on them?kokolegorille
Following my convention, I would use
wolfiton
Thanks @kokolegorille now i think I get it because i seen code using weird convention to define this relationship and odd naming.
kokolegorille
Sometime it makes sense to use more descriptive name…
For example, User m2m Role with a membership join table. Membership is much more descriptive than roles_users.
wolfiton
Sometimes but not in general, someone new can get easily confused by the naming, especially if he/she has just joined the project