質問編集履歴

1

参考になるかもしれないのでschema載せました

2018/04/13 11:05

投稿

takeke
takeke

スコア60

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,7 @@
1
+ 最近railsの勉強始めた者です。
2
+
3
+
4
+
1
5
  ECサイト作っていまして、現在管理者画面を製作しております。
2
6
 
3
7
  特に管理用のgemは使っていないので1からテーブル作ったりしているのですが、そこで1つわからないことが出てきたので質問させていただきました。
@@ -21,3 +25,135 @@
21
25
 
22
26
 
23
27
  改善の仕方、もしくはデータの取り方お分かりになる方いましたら宜しくお願いしますm(._.)m
28
+
29
+
30
+
31
+ ====================================================================================
32
+
33
+ 追記,
34
+
35
+ schema.rb
36
+
37
+
38
+
39
+
40
+
41
+ ```
42
+
43
+ ActiveRecord::Schema.define(version: 20180413103954) do
44
+
45
+
46
+
47
+ create_table "carts", force: :cascade do |t|
48
+
49
+ t.datetime "created_at", null: false
50
+
51
+ t.datetime "updated_at", null: false
52
+
53
+ end
54
+
55
+
56
+
57
+ create_table "categories", force: :cascade do |t|
58
+
59
+ t.string "c_name"
60
+
61
+ t.datetime "created_at", null: false
62
+
63
+ t.datetime "updated_at", null: false
64
+
65
+ end
66
+
67
+
68
+
69
+ create_table "favorites", force: :cascade do |t|
70
+
71
+ t.integer "user_id"
72
+
73
+ t.integer "product_id"
74
+
75
+ t.datetime "created_at", null: false
76
+
77
+ t.datetime "updated_at", null: false
78
+
79
+ end
80
+
81
+
82
+
83
+ create_table "line_items", force: :cascade do |t|
84
+
85
+ t.integer "product_id"
86
+
87
+ t.integer "cart_id"
88
+
89
+ t.datetime "created_at", null: false
90
+
91
+ t.datetime "updated_at", null: false
92
+
93
+ t.integer "quantity", default: 1
94
+
95
+ t.integer "order_id"
96
+
97
+ end
98
+
99
+
100
+
101
+ create_table "orders", force: :cascade do |t|
102
+
103
+ t.string "name"
104
+
105
+ t.text "address"
106
+
107
+ t.string "email"
108
+
109
+ t.string "pay_type"
110
+
111
+ t.datetime "created_at", null: false
112
+
113
+ t.datetime "updated_at", null: false
114
+
115
+ end
116
+
117
+
118
+
119
+ create_table "products", force: :cascade do |t|
120
+
121
+ t.string "title"
122
+
123
+ t.text "description"
124
+
125
+ t.string "image_url"
126
+
127
+ t.decimal "price", precision: 8, scale: 2
128
+
129
+ t.datetime "created_at", null: false
130
+
131
+ t.datetime "updated_at", null: false
132
+
133
+ t.string "category_id"
134
+
135
+ end
136
+
137
+
138
+
139
+ create_table "users", force: :cascade do |t|
140
+
141
+ t.string "name"
142
+
143
+ t.string "password_digest"
144
+
145
+ t.datetime "created_at", null: false
146
+
147
+ t.datetime "updated_at", null: false
148
+
149
+ end
150
+
151
+ end
152
+
153
+ ```
154
+
155
+ 一応載せておきます。
156
+
157
+
158
+
159
+ 管理画面の編集していますが、adminのテーブルは作っていません。