1
votes

I use the following db setup:

users:

  • id
  • name
  • country_id (FK)

countries

  • id
  • name

I use this setup for data integrity. When a user adds an account, a country dropdown is presented in the add form through a find(list).

The problem is that while Cake Baking, I can not choose a HasOne relationship between users and countries. I can only choose that a User BelongsTo a country.

What goes wrong here? Do I need to add the HasOne association manually or is the BelongsTo relationship correct?

Thanks

1

1 Answers

1
votes

I assume you mean hasMany, as in a country has many users. Yes, you'll have to define that in Country model, if you wish to have that relationship.