In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.
This video covers:
0:32 - Ruby exceptions
0:54 - Rescuing ActiveRecord::RecordNotDestroyed from destroy! with an inline rescue block
2:29 - The drawbacks of inline rescue for Rails controllers
3:56 - Using rescue_from to handle exceptions from any controller/action
5:36 - Moving the rescue_from to ApplicationController so that it handles exceptions from any controller in the application
6:38 - Rendering ActiveRecord object errors in the API response body
✨ Check out the new version of this video series, which has been updated for Rails 7 • Rails 7 API Tutorial - Create project...
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rail...
If you’re new to this series, you may want to start with part 1: • Rails 6 API Tutorial - Create project...