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

質問編集履歴

2

コード追加しています。

2020/03/03 01:32

投稿

maru0303
maru0303

スコア5

title CHANGED
File without changes
body CHANGED
@@ -113,6 +113,29 @@
113
113
 
114
114
  コード
115
115
  ```
116
+ ```
117
+ routes.rb
118
+ Rails.application.routes.draw do
119
+
120
+ get 'sessions/new'
121
+ get 'sessions/create'
122
+ get 'sessions/destroy'
123
+ get 'login', to: 'sessions#new'
124
+ post 'login', to: 'sessions#create'
125
+ delete 'logout', to: 'sessions#destroy'
126
+
127
+ root to: 'tasks#index'
128
+
129
+ get 'signup', to: 'users#new'
130
+ resources :users, only: [:new, :create]
131
+ resources :tasks
132
+ end
133
+ コード
134
+ ```
135
+ ```
136
+
137
+ コード
138
+ ```
116
139
  [エラー画面]
117
140
  (https://gyazo.com/a4095a668272271299c75d465c9071b5)
118
141
  エラー内容

1

エラー内容追記しました。も

2020/03/03 01:32

投稿

maru0303
maru0303

スコア5

title CHANGED
File without changes
body CHANGED
@@ -113,4 +113,19 @@
113
113
 
114
114
  コード
115
115
  ```
116
+ [エラー画面]
116
- [エラー画面](https://gyazo.com/a4095a668272271299c75d465c9071b5)
117
+ (https://gyazo.com/a4095a668272271299c75d465c9071b5)
118
+ エラー内容
119
+ NoMethodError in Tasks#create
120
+ Showing /home/ec2-user/environment/tasklist/app/views/tasks/_form.html.erb where line #3 raised:
121
+
122
+ undefined method `to_model' for #<Task::ActiveRecord_AssociationRelation:0x0000000006c84a00>
123
+ Did you mean? to_xml
124
+ Extracted source (around line #3):
125
+
126
+ 1<div class ="row">
127
+ 2 <div class= "col-6">
128
+ 3 <%= form_with(model: task, local: true) do |f| %>
129
+ 4 <% if task.errors.any? %>
130
+ 5 <div id="error_explanation" class ="alert alert-warning">
131
+ 6 <ul>