Suppose you have two parent-child models.
When linked with belongs_to, the check of the primary key and foreign key runs, but
Since the primary key is id, I want to check only the foreign key.
・ What I tried
Assuming the foreign key is test_key, I tried the following but couldn't.
Answer # 1
This question was successfully resolved.
Thank you to everyone who answered.
- ruby - pass the value from the controller in the rails model
- ruby on rails - how to validate password (half-width alphanumeric characters)
- [ruby on rails] how to write when getting a model nested in multiple stages with includes
- ruby - [rails] i want to find the date difference using the model created_at
- ruby on rails - returns a value from the rails model to the controller
- [ruby on rails] i want to display a parent model that matches the information of the associated child model
- ruby on rails - the link between the model created by devise and the model originally created does not work
- ruby on rails - things associated with a foreign key cannot be called in view
- ruby - unable to create rails model (environment: cloud9)
- ruby on rails - i can't create a model with rails
- ruby on rails - about the code of the adjacency list model implemented in rails
- ruby on rails 5 - child model record not created
- ruby on rails - rails associated model is not saved in db
- ruby on rails - product model test code does not succeed
- ruby on rails - extract multiple specific columns from one activerecord and make them json
- ruby on rails 6 - i changed the project name of rails, but it became inaccessible
- ruby on rails - i want to resolve rails nameerror
- ruby on rails - i can't update rubygems
- ruby on rails - [rails] about the display position after redirect by pressing like
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- i want to check the type of a shell script variable