How do you create foreign key values ​​in FactoryBot ~ (crying

Introduction

I made some progress due to the error related to the test code I posted the other day, so I will record it.

Posted the other day ↓ "I'm writing test code using RSpec, but it doesn't work"

inspection result

Hypothesis 2 turned out to be probably irrelevant. Helper method Changing from number_field to text_field did not help solve the problem. Since it still cannot be saved well, it is considered that an error has occurred in the part related to the foreign key of Hypothesis 1. By validating that it is a foreign key in the model, it is possible that the primary key cannot be found by simply entering the ID.

Finally

We will continue to verify that the test code works.

Recommended Posts

How do you create foreign key values ​​in FactoryBot ~ (crying
How to write an external reference key in FactoryBot
How to use a foreign key with FactoryBot ~ Another solution
[Rails] How to write user_id (foreign key) in strong parameter
How to rename a model with foreign key constraints in Rails
Do you use Stream in Java?
How do you write in Scala that was written in Java? (List → Map)
How do you write the ternary operator (? :)
How to do base conversion in Java
How to delete data with foreign key