Тэги:
#Rails #Rails_API #Rails_API-only #GoRails #Traversy_Media #Deanin #Rails_6 #Rails_6_API #Rails_TDD #Rails_test_driven_development #Rails_API_TDD #Rails_API_binding.irb #Rails_6_API_TDD #Rails_6_TDD #Rails_6_binding.irb #Rails_6_API_Controller_multiple_records #Rails_6_API_controller_associated_records #Rails_6_API_debugging #Rails_API_debugging #Rails_API_multiple_params #Rails_API_merge_params #Rails_API_test_driven_development #Rails_6_API-only_TDD #Rails_6_API_only_TDDКомментарии:
Thanks man, this series helped me a lot ❤
Ответитьauthor create should be its own endpoint
ОтветитьI learned a lot in this video! thank you <3
ОтветитьThis is great! How would you handle the strong_params if you wanted to accept an array of authors for a book?
ОтветитьReally helpful series. Only suggestion I have here is to use Author.find_or_create_by(author_params) to avoid duplicate authors.
ОтветитьThank you a lot. It`s really helpful.
ОтветитьIt would make a lot more sense to have book have accepts_nested_attributes_for :author, then you can just pass the whole params objected Book.create and the book and the author will be created at the same time. It would also rollback correctly if the author was saved, but the book failed validation, in your current implementation this scenario would leave an orphaned author record.
Ответить311 subscriber
Ответить