Phoenix v1.3.0-rc.0 released

I’m interested in this topic as I’m developing a Phoenix 1.3 application as a learning tool to get comfortable with the conventions around contexts and API boundaries. Something I’ve noticed is that embedded schemas don’t quite fit into the pattern of code that’s generated by Phoenix. For example, create_<object> doesn’t necessarily make sense for an embedded changeset (say, to validate fields for a login form).

This is also related to the topic in https://elixirforum.com/t/clarity-needed-on-phoenix-1-3-contexts-and-schema-in-controllers/4097/7. Since it’s often required to generate an empty changeset, it would be good to have a function for that purpose automatically generated on the context module. @shankardevy suggests build_<object>/1, which I find sensible.

Furthermore, I would agree that the private functions to generate changesets (<object>_changeset/2) may be better positioned on the schemas themselves – as this is most likely where developers will be implementing things like required fields, validation etc.

Overall, though, I think the changes are really great - so thank you for all your hard work!

2 Likes