質問編集履歴
1
コードを変えた
test
CHANGED
File without changes
|
test
CHANGED
@@ -127,3 +127,167 @@
|
|
127
127
|
|
128
128
|
|
129
129
|
```
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
new.html.erb
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
<div class="container">
|
138
|
+
|
139
|
+
<div class="row">
|
140
|
+
|
141
|
+
<div class="col mx-auto w-75">
|
142
|
+
|
143
|
+
<div class="customer-title">
|
144
|
+
|
145
|
+
<h4 class="bg-light text-center m-4" style="width:20%;">新規会員登録</h4>
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<%= form_for (@customer),url: customer_registration_path do |f| %>
|
150
|
+
|
151
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
152
|
+
|
153
|
+
<div class="customer-list d-flex">
|
154
|
+
|
155
|
+
<div class="customer-left">
|
156
|
+
|
157
|
+
<div class="customer-item">
|
158
|
+
|
159
|
+
<p>名前</p>
|
160
|
+
|
161
|
+
<p>フリガナ</p>
|
162
|
+
|
163
|
+
<p>メールアドレス</p>
|
164
|
+
|
165
|
+
<p>郵便便番号(ハイフンなし)</p>
|
166
|
+
|
167
|
+
<p>住所</p>
|
168
|
+
|
169
|
+
<p>電話番号(ハイフンなし)</p>
|
170
|
+
|
171
|
+
<p>パスワード(6文字以上)</p>
|
172
|
+
|
173
|
+
<p>パスワード(確認用)</p>
|
174
|
+
|
175
|
+
</div>
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
<div class="customer-right pl-4">
|
180
|
+
|
181
|
+
<div class="customer-name d-flex p-1">
|
182
|
+
|
183
|
+
(姓) <%= f.text_field :last_name %>
|
184
|
+
|
185
|
+
(名) <%= f.text_field :first_name %>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div class="customer-name2 d-flex p-1">
|
190
|
+
|
191
|
+
(セイ) <%= f.text_field :last_name_kana %>
|
192
|
+
|
193
|
+
(メイ) <%= f.text_field :first_name_kana %>
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div class="customer-email p-1">
|
198
|
+
|
199
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div class="customer-postal_code p-1">
|
204
|
+
|
205
|
+
<%= f.text_field :postal_code %>
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<div class="customer-street-address p-1">
|
210
|
+
|
211
|
+
<%= f.text_field :address %>
|
212
|
+
|
213
|
+
</div>
|
214
|
+
|
215
|
+
<div class="customer-phone p-1">
|
216
|
+
|
217
|
+
<%= f.telephone_field :telephone_number %>
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div class="customer-password p-1">
|
222
|
+
|
223
|
+
<% if @minimum_password_length %>
|
224
|
+
|
225
|
+
<% end %>
|
226
|
+
|
227
|
+
<%= f.password_field :password, autocomplete: "new-password" %>
|
228
|
+
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div class="customer-password2 p-1">
|
232
|
+
|
233
|
+
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
234
|
+
|
235
|
+
</div>
|
236
|
+
|
237
|
+
<div class="actions mt-3">
|
238
|
+
|
239
|
+
<%= f.submit "新規登録",:class=>"bg-success text-white border border-light",:style=>"padding-right:50px; padding-left:50px;" %>
|
240
|
+
|
241
|
+
</div>
|
242
|
+
|
243
|
+
</div>
|
244
|
+
|
245
|
+
</div>
|
246
|
+
|
247
|
+
<% end %>
|
248
|
+
|
249
|
+
<div class="customer-login">
|
250
|
+
|
251
|
+
<h4 class="bg-light w-25 m-4 text-center">既に登録済みの方</h4>
|
252
|
+
|
253
|
+
<p class="m-2"><%= link_to "こちら", new_customer_session_path,:class=>"m-2" %> からログインしてください</p>
|
254
|
+
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
</div>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
```
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
customer.rb
|
270
|
+
|
271
|
+
```
|
272
|
+
|
273
|
+
class Customer < ApplicationRecord
|
274
|
+
|
275
|
+
# Include default devise modules. Others available are:
|
276
|
+
|
277
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
278
|
+
|
279
|
+
devise :database_authenticatable, :registerable,
|
280
|
+
|
281
|
+
:recoverable, :rememberable, :validatable
|
282
|
+
|
283
|
+
has_many :cart_items, dependent: :destroy
|
284
|
+
|
285
|
+
has_many :orders, dependent: :destroy
|
286
|
+
|
287
|
+
belongs_to :address,optional: true
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
```
|