Unless I’m misunderstanding something I think this is exactly what Phoenix is not your application is all about. If the functionality for creating Todos wasn’t buried in the TodoController
it would be much easier for UserController
to create Todos.
Also
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave . On generating the Phoenix app he uses the --no-ecto flag and explains why:
I don’t think anybody needs to add a database layer into their Phoenix application. Because Phoenix is purely concerned with communicating on the web, and anything you use a database for should be in its own separate service. So I don’t see any point at all in putting Ecto into any Phoenix application that you generate from scratch, …
I’ve been thinking about this a lot lately and I worry that we are raising the barrier to entry with talk like that. I’ve seen ElixirConf talks and DailyDrip videos that put the emphasis there. While I agree with the long term architecture pattern of looking at Phoenix as just the web interface to your application, OTP and BEAM are very large and take a while to fully wrap your head around. It can leave you with the feeling that by building a fully functional app within Phoenix as you would in a…
3 Likes