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

質問編集履歴

2

スペルミスなどあったため修正していたら、エラー内容が変わったため修正

2020/10/09 10:28

投稿

yyyyyyyyyy
yyyyyyyyyy

スコア1

title CHANGED
File without changes
body CHANGED
@@ -8,10 +8,9 @@
8
8
  <%= link_to image_tag(prototype.image, class: :card__img ), prototype_path(prototype) %>
9
9
  ```
10
10
  と記述し実行したところ、
11
- **NoMethodError in Prototype#index**
11
+ **ArgumentError in Prototype#index**
12
12
 
13
- **undefined method `prototype_path' for #<#<Class:0x00007ff59b032be8>:0x00007ff59b037378>
13
+ **Can't resolve image into URL: to_model delegated to attachment, but attachment is nil**
14
- Did you mean? prototype_index_path**
15
14
 
16
15
  とエラー表示されました。
17
16
 

1

prototype_pathの場所について追記

2020/10/09 10:28

投稿

yyyyyyyyyy
yyyyyyyyyy

スコア1

title CHANGED
File without changes
body CHANGED
@@ -104,6 +104,14 @@
104
104
  end
105
105
  end
106
106
  ```
107
+ routes.rb
108
+ ```
109
+ Rails.application.routes.draw do
110
+ devise_for :users
111
+ root to: 'prototype#index'
112
+ resources :prototype,only: [:index,:new,:create]
113
+ end
114
+ ```
107
115
  ### 試したこと
108
116
 
109
117
  アソシエーションが間違っているために、prototype.imageで取得できていないのだと思い、アソシエーションの見直しを行いましたが、間違いが発見できませんでした。