質問編集履歴
1
コードを変えた
title
CHANGED
File without changes
|
body
CHANGED
@@ -62,4 +62,86 @@
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
```
|
66
|
+
|
67
|
+
new.html.erb
|
68
|
+
```
|
69
|
+
<div class="container">
|
70
|
+
<div class="row">
|
71
|
+
<div class="col mx-auto w-75">
|
72
|
+
<div class="customer-title">
|
73
|
+
<h4 class="bg-light text-center m-4" style="width:20%;">新規会員登録</h4>
|
74
|
+
</div>
|
75
|
+
<%= form_for (@customer),url: customer_registration_path do |f| %>
|
76
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
77
|
+
<div class="customer-list d-flex">
|
78
|
+
<div class="customer-left">
|
79
|
+
<div class="customer-item">
|
80
|
+
<p>名前</p>
|
81
|
+
<p>フリガナ</p>
|
82
|
+
<p>メールアドレス</p>
|
83
|
+
<p>郵便便番号(ハイフンなし)</p>
|
84
|
+
<p>住所</p>
|
85
|
+
<p>電話番号(ハイフンなし)</p>
|
86
|
+
<p>パスワード(6文字以上)</p>
|
87
|
+
<p>パスワード(確認用)</p>
|
88
|
+
</div>
|
89
|
+
</div>
|
90
|
+
<div class="customer-right pl-4">
|
91
|
+
<div class="customer-name d-flex p-1">
|
92
|
+
(姓) <%= f.text_field :last_name %>
|
93
|
+
(名) <%= f.text_field :first_name %>
|
94
|
+
</div>
|
95
|
+
<div class="customer-name2 d-flex p-1">
|
96
|
+
(セイ) <%= f.text_field :last_name_kana %>
|
97
|
+
(メイ) <%= f.text_field :first_name_kana %>
|
98
|
+
</div>
|
99
|
+
<div class="customer-email p-1">
|
100
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
101
|
+
</div>
|
102
|
+
<div class="customer-postal_code p-1">
|
103
|
+
<%= f.text_field :postal_code %>
|
104
|
+
</div>
|
105
|
+
<div class="customer-street-address p-1">
|
106
|
+
<%= f.text_field :address %>
|
107
|
+
</div>
|
108
|
+
<div class="customer-phone p-1">
|
109
|
+
<%= f.telephone_field :telephone_number %>
|
110
|
+
</div>
|
111
|
+
<div class="customer-password p-1">
|
112
|
+
<% if @minimum_password_length %>
|
113
|
+
<% end %>
|
114
|
+
<%= f.password_field :password, autocomplete: "new-password" %>
|
115
|
+
</div>
|
116
|
+
<div class="customer-password2 p-1">
|
117
|
+
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
118
|
+
</div>
|
119
|
+
<div class="actions mt-3">
|
120
|
+
<%= f.submit "新規登録",:class=>"bg-success text-white border border-light",:style=>"padding-right:50px; padding-left:50px;" %>
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
<% end %>
|
125
|
+
<div class="customer-login">
|
126
|
+
<h4 class="bg-light w-25 m-4 text-center">既に登録済みの方</h4>
|
127
|
+
<p class="m-2"><%= link_to "こちら", new_customer_session_path,:class=>"m-2" %> からログインしてください</p>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
```
|
133
|
+
|
134
|
+
|
135
|
+
customer.rb
|
136
|
+
```
|
137
|
+
class Customer < ApplicationRecord
|
138
|
+
# Include default devise modules. Others available are:
|
139
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
140
|
+
devise :database_authenticatable, :registerable,
|
141
|
+
:recoverable, :rememberable, :validatable
|
142
|
+
has_many :cart_items, dependent: :destroy
|
143
|
+
has_many :orders, dependent: :destroy
|
144
|
+
belongs_to :address,optional: true
|
145
|
+
end
|
146
|
+
|
65
147
|
```
|