Commit a8a8dad5 authored by Mike Jang's avatar Mike Jang

Merge branch 'docs-add-primary-key-to-model-example' into 'master'

Add key to model on Foreign Keys & Associations docs

See merge request gitlab-org/gitlab!29125
parents 428f35cc 092cb0bb
......@@ -87,3 +87,13 @@ create_table :user_configs, id: false do |t|
...
end
```
You will also need to add the new primary key to the model:
```ruby
class UserConfig < ActiveRecord::Base
self.primary_key = :user_id
belongs_to :user
end
```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment