Sanjibukai
How to manage embedded schema in generators and form?
Hi everybody!
How do you handle embedded schemas (the map fields in JSON or JSONB) with generators and forms?
I have a situation where I have one schema (Account) that will have some embedded schemas (MemberS, Contact).
I’m going with embedded schema because I’m not sure of how the underlying data will end up.
But I have two questions about embedded schemas:
- How to handle them using generators (particularly
mix.gen.html)?
I guess that ignoring the field and populating manually should be the easiest but then I would have to generate every bit of HTML.. - Should I use
form_fororinputs_for?
Also I’ll probably go with a JS solution that will add more fields for the Members since I’ll have embeds_many for this. But what will be the id and name fields I should set manually?
I remember having some very hard time in Rails for (and I’m not even talking about casting datas) despite those kind of form management should be trivial (at least for a web application)..
Hopefully I think it will be easier with Phoenix and Ecto Changeset..
First Post!
AllanPinheiroDeLima
Hi, I’m having the same issue.
Have you solved yours ?
Popular in Questions
Other popular topics
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
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








