teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

user.rbの追加

2020/09/19 09:33

投稿

renat
renat

スコア2

title CHANGED
File without changes
body CHANGED
@@ -248,7 +248,32 @@
248
248
  end
249
249
 
250
250
  ```
251
+ app/models/user.rb
251
252
 
253
+ ```ここに言語を入力
254
+ # == Schema Information
255
+ #
256
+ # Table name: users
257
+ #
258
+ # id :bigint not null, primary key
259
+ # admin :boolean default(FALSE)
260
+ # email :string(255)
261
+ # name :string(255)
262
+ # password_digest :string(255)
263
+ # remember_digest :string(255)
264
+ # created_at :datetime not null
265
+ # updated_at :datetime not null
266
+ #
267
+ # Indexes
268
+ #
269
+ # index_users_on_email (email) UNIQUE
270
+ #
271
+ class User < ApplicationRecord
272
+ has_many :lists, dependent: :destroy
273
+ end
274
+
275
+ ```
276
+
252
277
  ### 試したこと
253
278
 
254
279
  記事からいろいろ試してみましたが、ダメでした・・・

1

加筆

2020/09/19 09:33

投稿

renat
renat

スコア2

title CHANGED
File without changes
body CHANGED
@@ -41,8 +41,8 @@
41
41
 
42
42
  ```
43
43
  ### 該当のソースコード
44
-
45
- ```db/seeds.rb
44
+ db/seeds.rb
45
+ ```
46
46
  user = User.all
47
47
  user.lists.create!(
48
48
  [
@@ -102,8 +102,8 @@
102
102
  },
103
103
 
104
104
  ```
105
-
105
+ app/models/list.rb
106
- ```list.rb
106
+ ```
107
107
  # == Schema Information
108
108
  #
109
109
  # Table name: lists
@@ -137,8 +137,8 @@
137
137
  end
138
138
 
139
139
  ```
140
-
141
- ```lists_controller.rb
140
+ app/controllers/lists_controller.rb
141
+ ```
142
142
  class ListsController < ApplicationController
143
143
  before_action :logged_in_user, only: [:create, :destroy]
144
144
  before_action :correct_user, only: :destroy
@@ -188,8 +188,8 @@
188
188
  end
189
189
 
190
190
  ```
191
-
192
- ```sessions_helper.rb
191
+ app/helpers/sessions_helper.rb
192
+ ```
193
193
  module SessionsHelper
194
194
 
195
195
  # 渡されたユーザーでログインする