Rails 6 API Tutorial - Creating Multiple Records in Controllers p.13

Опубликовано: 20 Февраль 2026
на канале: Rails Pro
5,073
103

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.

✨ Check out the new version of this video series, which has been updated for Rails 7    • Rails 7 API Tutorial - Create project and ...  

📖 You can also purchase the eBook and code for the new Rails 7 tutorial - https://tomkadwill.gumroad.com/l/rail...

This video covers:
0:00 - Introduction
0:32 - Benefits of using test driven development (TDD)
0:59 - Running the failing CREATE action spec
2:06 - Rewriting the params in separate book and author hashes
4:02 - Debugging the test failure using binding.irb
5:26 - Creating multiple records in the controller
6:41 - Merging author_id into the book params to associate the two records together
8:16 - Tidying up the book_params method
8:48 - Adding an assertion to check the Author record was created in the DB

If you’re new to this series, you may want to start with part 1:    • Rails 6 API Tutorial - Create project and ...