Several Destroy All Software Screencasts have shown ways to "fight" web frameworks like Rails, avoiding its design primitives. Usually these focus on using service objects instead of controllers and models. This screencast demonstrates a refactoring where Rails primitives do provide the best design after all. We start with two controllers, refactoring them to move behavior out. At the end, the controllers only do delegation and translation to and from HTTP.
Note: There's a mistake in the "Account.create_with_schema" method: it should take the account parameters from the controller. This doesn't affect any of the content of the screencast, fortunately.
Execute Program
Looking for something more interactive? Try Execute Program, an interactive learning platform from Destroy All Software LLC! It has courses on TypeScript, SQL, regular expressions, JavaScript concurrency, and more. All Destroy All Software subscriptions include full access to Execute Program, or you can subscribe to Execute Program directly.