A step-by-step guide how to improve your Rails controllers in a quick and safe way. The techniques described in this book will help you reduce the test time, increase the time to add new features and will make you proud of the codebase. Introducing service objects is an often recommended technique to improve the situation. Most of the blog posts in the Internet focus on simple situations, which are far from real-life Rails code. This book aims to fill the gap and teach you step-by-step how to introduce services in the typical situations.
A set of techniques you can apply to your both new or legacy code. You’ll learn:
- How to make your frontend more independent and boost your frontend-first development speed by introducing UUIDs instead of sequential IDs generated by Rails. A step-by-step, database-agnostic, legacy-ready solution is presented.
- How to avoid very often headaches while migrating assets to a different domain by knowing what is CORS, how it works and how to configure it correctly in Rails.
- How to stop inventing your own response formats and waste time by implementing the JSON API industry standard, making your API ready for even the wildest of features.
- How to create a real-time API by implementing the real-time messaging bus and making it indistinguishable from user actions. This is the most maintainable solution I’ve encountered in the wild so far.
- How to get your thinking about frontend on the higher level by knowing and understanding consequences of your frontend decisions.