質問編集履歴

1

引用するビューファイルの内容が間違っておりましたので訂正します。

2018/08/27 12:47

投稿

xk2ykx
xk2ykx

スコア11

test CHANGED
File without changes
test CHANGED
@@ -120,25 +120,53 @@
120
120
 
121
121
  ```app/views.html.erb
122
122
 
123
- class User < ApplicationRecord
123
+ <% provide(:title, 'Sign up') %>
124
124
 
125
- before_save { self.email = email.downcase }
125
+ <h1>Sign up</h1>
126
126
 
127
- validates :name, presence: true, length: { maximum: 50 }
128
127
 
129
- VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+.[a-z]+\z/i
130
128
 
131
- validates :email, presence: true, length: { maximum: 255 },
129
+ <div class="row">
132
130
 
133
- format: { with: VALID_EMAIL_REGEX },
131
+ <div class="col-md-6 col-md-offset-3">
134
132
 
135
- uniqueness: { case_sensitive: false }
133
+ <%= form_for(@user , url: signup_path ) do |f| %>
136
134
 
137
- has_secure_password
135
+ <%= render 'shared/error_messages' %>
138
136
 
139
- validates :password, presence: true, length: { minimum: 6 }
137
+
140
138
 
139
+ <%= f.label :name %>
140
+
141
+ <%= f.text_field :name, class: 'form-control' %>
142
+
143
+
144
+
145
+ <%= f.label :email %>
146
+
147
+ <%= f.email_field :email,class: 'form-control' %>
148
+
149
+
150
+
151
+ <%= f.label :password %>
152
+
153
+ <%= f.password_field :password, class: 'form-control' %>
154
+
155
+
156
+
157
+ <%= f.label :password_confirmation, "Confirmation" %>
158
+
159
+ <%= f.password_field :password_confirmation, class: 'form-control' %>
160
+
161
+
162
+
163
+ <%= f.submit "Create my account", class: "btn btn-primary" %>
164
+
141
- end
165
+ <% end %>
166
+
167
+ </div>
168
+
169
+ </div>
142
170
 
143
171
 
144
172