質問編集履歴

1

スキーマの情報、モデルの情報を追加

2018/12/22 12:04

投稿

jsaku
jsaku

スコア15

test CHANGED
File without changes
test CHANGED
@@ -57,3 +57,81 @@
57
57
 
58
58
 
59
59
  ### 補足情報(FW/ツールのバージョンなど)
60
+
61
+
62
+
63
+ スキーマは下記の表示がされてます。
64
+
65
+ ```ruby
66
+
67
+ create_table "posts", force: :cascade do |t|
68
+
69
+ t.integer "post_image_id"
70
+
71
+ t.text "post_content"
72
+
73
+ t.datetime "created_at", null: false
74
+
75
+ t.datetime "updated_at", null: false
76
+
77
+ t.integer "team_id"
78
+
79
+ t.integer "user_id"
80
+
81
+ end
82
+
83
+ ```
84
+
85
+
86
+
87
+ Postモデルは下記の表示がされてます。
88
+
89
+ ```ruby
90
+
91
+
92
+
93
+ class Post < ApplicationRecord
94
+
95
+ has_many :post_favorites
96
+
97
+ has_many :post_comments
98
+
99
+
100
+
101
+ belongs_to :user_id
102
+
103
+ belongs_to :team_id
104
+
105
+
106
+
107
+ attachment :post_image
108
+
109
+ end
110
+
111
+
112
+
113
+ ```
114
+
115
+
116
+
117
+ Teamモデルは下記の表示がされてます。
118
+
119
+ ```ruby
120
+
121
+ class Team < ApplicationRecord
122
+
123
+ has_many :members, dependent: :destroy
124
+
125
+ has_many :users, through: :members
126
+
127
+
128
+
129
+ has_many :posts, dependent: :destroy
130
+
131
+
132
+
133
+ attachment :team_image
134
+
135
+ end
136
+
137
+ ```