Column | Type | Options |
---|---|---|
name | string | add_index :users, :name, null: false, unique: true |
string | null: false | |
password | integer | null: false |
user_id | integer | null: false, foreign_key: true |
gender | enum('M','F') | |
age | integer |
- has_many : pins
- has_many : user_boards
- has_many : boards, through: :user_boards
Column | Type | Options |
---|---|---|
name | string | add_index :boards, :name, null: false, unique: true |
- has_many : pins
- has_many : user_boards
- has_many : users, through: :user_boards
Column | Type | Options |
---|---|---|
user_id | references | null: false, foreign_key: true |
boards_id | references | null: false, foreign_key: true |
- belongs_to : user
- belongs_to : board
Column | Type | Options |
---|---|---|
title | string | |
description | ||
image | string | null: false |
board_id | references | null: false, foreign_key: true |
user_id | references | null: false, foreign_key: true |
- has_many : board_pins
- has_many : boards, through: :board_pins
- belongs_to : user
Column | Type | Options |
---|---|---|
pin_id | references | null: false, foreign_key: true |
boards_id | references | null: false, foreign_key: true |
- belongs_to : pin
- belongs_to : board