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

質問編集履歴

9

文章修正

2020/06/15 12:01

投稿

herisson0818
herisson0818

スコア3

title CHANGED
File without changes
body CHANGED
@@ -69,17 +69,6 @@
69
69
  ```
70
70
 
71
71
  ```
72
- 【scheme.rb】
73
-
74
-  create_table "tasks", force: :cascade do |t|
75
- t.string "name", limit: 30, null: false
76
- t.text "description"
77
- t.datetime "created_at", precision: 6, null: false
78
- t.datetime "updated_at", precision: 6, null: false
79
- end
80
- ```
81
-
82
- ```
83
72
  【user.rb】
84
73
 
85
74
  class User < ApplicationRecord
@@ -90,4 +79,15 @@
90
79
 
91
80
  has_many :tasks
92
81
  end
82
+ ```
83
+
84
+ ```
85
+ 【scheme.rb】
86
+
87
+  create_table "tasks", force: :cascade do |t|
88
+ t.string "name", limit: 30, null: false
89
+ t.text "description"
90
+ t.datetime "created_at", precision: 6, null: false
91
+ t.datetime "updated_at", precision: 6, null: false
92
+ end
93
93
  ```

8

文章修正

2020/06/15 12:01

投稿

herisson0818
herisson0818

スコア3

title CHANGED
File without changes
body CHANGED
@@ -1,7 +1,6 @@
1
1
  お世話になります。Ruby初心者です。
2
2
  現在、Rubyでタスク管理アプリを製作しているものです。
3
3
  完成を間近にしてエラーにハマってしまっています。
4
- taskがない状況がマズいと思い、色々試しているのですが、解決に至りません。
5
4
  よろしければお力添えお願いいたします。
6
5
  エラー内容は以下の通りです。
7
6
  ![イメージ説明](7bd89420f574f0e8221e13804e95e54b.png)

7

文章修正

2020/06/15 12:00

投稿

herisson0818
herisson0818

スコア3

title CHANGED
File without changes
body CHANGED
@@ -7,7 +7,7 @@
7
7
  ![イメージ説明](7bd89420f574f0e8221e13804e95e54b.png)
8
8
  ```
9
9
  【エラーメッセージ】
10
- Showing /Users/lyla0818/task-manager/app/views/tasks/index.html.slim where line #11 raised:
10
+ Showing /Users/Username/task-manager/app/views/tasks/index.html.slim where line #11 raised:
11
11
 
12
12
  PG::UndefinedColumn: ERROR: column tasks.user_id does not exist
13
13
  LINE 1: SELECT "tasks".* FROM "tasks" WHERE "tasks"."user_id" = $1 O...

6

2020/06/15 11:59

投稿

herisson0818
herisson0818

スコア3

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,6 @@
1
1
  お世話になります。Ruby初心者です。
2
2
  現在、Rubyでタスク管理アプリを製作しているものです。
3
- 完成を間近にしてエラーにハマってしまっています。
3
+ 完成を間近にしてエラーにハマってしまっています。
4
4
  taskがない状況がマズいと思い、色々試しているのですが、解決に至りません。
5
5
  よろしければお力添えお願いいたします。
6
6
  エラー内容は以下の通りです。

5

user.rbを追加しました。

2020/06/15 11:41

投稿

herisson0818
herisson0818

スコア3

title CHANGED
File without changes
body CHANGED
@@ -78,4 +78,17 @@
78
78
  t.datetime "created_at", precision: 6, null: false
79
79
  t.datetime "updated_at", precision: 6, null: false
80
80
  end
81
+ ```
82
+
83
+ ```
84
+ 【user.rb】
85
+
86
+ class User < ApplicationRecord
87
+ has_secure_password
88
+
89
+ validates :name, presence: true
90
+ validates :email, presence: true, uniqueness: true
91
+
92
+ has_many :tasks
93
+ end
81
94
  ```

4

文章修正

2020/06/15 11:29

投稿

herisson0818
herisson0818

スコア3

title CHANGED
File without changes
body CHANGED
@@ -1,9 +1,12 @@
1
1
  お世話になります。Ruby初心者です。
2
2
  現在、Rubyでタスク管理アプリを製作しているものです。
3
- 完成を間近にしてエラー沼にハマってしまっています。よろしければお力添えお願いいたします。
3
+ 完成を間近にしてエラー沼にハマってしまっています。
4
+ taskがない状況がマズいと思い、色々試しているのですが、解決に至りません。
5
+ よろしければお力添えお願いいたします。
4
6
  エラー内容は以下の通りです。
5
7
  ![イメージ説明](7bd89420f574f0e8221e13804e95e54b.png)
6
8
  ```
9
+ 【エラーメッセージ】
7
10
  Showing /Users/lyla0818/task-manager/app/views/tasks/index.html.slim where line #11 raised:
8
11
 
9
12
  PG::UndefinedColumn: ERROR: column tasks.user_id does not exist

3

エラー画面を追加しました。

2020/06/14 22:17

投稿

herisson0818
herisson0818

スコア3

title CHANGED
@@ -1,1 +1,1 @@
1
- 「PG::UndefinedColumn: ERROR: column tasks.user_id does not exist」でエラーが発生する
1
+ タスク管理アプリでエラー「PG::UndefinedColumn: ERROR: column tasks.user_id does not exist」
body CHANGED
@@ -1,8 +1,8 @@
1
- お世話になります。
1
+ お世話になります。Ruby初心者です。
2
2
  現在、Rubyでタスク管理アプリを製作しているものです。
3
3
  完成を間近にしてエラー沼にハマってしまっています。よろしければお力添えお願いいたします。
4
4
  エラー内容は以下の通りです。
5
-
5
+ ![イメージ説明](7bd89420f574f0e8221e13804e95e54b.png)
6
6
  ```
7
7
  Showing /Users/lyla0818/task-manager/app/views/tasks/index.html.slim where line #11 raised:
8
8
 

2

taskのschemeを追加しました。よろしくお願いします。

2020/06/14 22:13

投稿

herisson0818
herisson0818

スコア3

title CHANGED
File without changes
body CHANGED
@@ -64,4 +64,15 @@
64
64
  errors.add(:name, 'にカンマを含めることはできません') if name&.include?(',')
65
65
  end
66
66
  end
67
+ ```
68
+
69
+ ```
70
+ 【scheme.rb】
71
+
72
+  create_table "tasks", force: :cascade do |t|
73
+ t.string "name", limit: 30, null: false
74
+ t.text "description"
75
+ t.datetime "created_at", precision: 6, null: false
76
+ t.datetime "updated_at", precision: 6, null: false
77
+ end
67
78
  ```

1

2020/06/14 21:41

投稿

herisson0818
herisson0818

スコア3

title CHANGED
File without changes
body CHANGED
@@ -11,6 +11,7 @@
11
11
  ```
12
12
 
13
13
  発生箇所とされている箇所のコードは以下の通りです。こちらの11行目が指定されているエラー箇所です。
14
+ エラー箇所:- @tasks.each do |task|
14
15
  ```
15
16
  【index.html.slim】
16
17