Thank you! I think I got the intent
Your example is more clear to me than the blog post.
Things that got me confused:
- Errors falling through
with. Then why usewith? - The first condition in the
withispage = CMS.get_page!(id), but if we don’t care about matching, why even put it in thewith, it could well be outside, especially if it raises, which would make it even more clear. Thewith(to me) forget_page!/1is a bit of indirection. - The scope of
pageis then used in theredirect, how? (is that a mistype?)
In any case, your example of the changeset in the middle of the with is more understandable to me. I wouldn’t want to execute the create_changeset unless the :ok prior succeeded. Also, changeset is likely not fail, and I don’t want to use it for matching anyway (since it would be used in the else clause.
(I don’t think I’ve explained it well)
Thank you again.






















