質問編集履歴

1

エラー内容の追記&userモデルの追記

2020/09/21 10:52

投稿

Misa0
Misa0

スコア2

test CHANGED
File without changes
test CHANGED
@@ -176,7 +176,43 @@
176
176
 
177
177
  ```
178
178
 
179
-
179
+ ```
180
+
181
+ ActiveRecord::RecordInvalid in UsersController#update
182
+
183
+ Validation failed: Password
184
+
185
+ ```
186
+
187
+ ```ruby
188
+
189
+ class User < ApplicationRecord
190
+
191
+ devise :database_authenticatable, :registerable,
192
+
193
+ :recoverable, :rememberable, :validatable
194
+
195
+
196
+
197
+ has_many :patient_users
198
+
199
+ has_many :patients, through: :patient_users
200
+
201
+
202
+
203
+ with_options presence: true do
204
+
205
+ validates :name, uniqueness: { case_sensitive: true }, length: { maximum: 15 }
206
+
207
+ end
208
+
209
+ PASSWORD_REGEX = /\A(?=.*?[a-z])(?=.*?[\d])[a-z\d]+\z/i.freeze
210
+
211
+ validates_format_of :password, with: PASSWORD_REGEX, message: ''
212
+
213
+ end
214
+
215
+ ```
180
216
 
181
217
  ### 試したこと
182
218