エラー内容
ActionController::UnknownFormat (Users::TimelinesController#index is missing a template for this request format and variant.
request.formats: ["text/html"]
request.variant: []
NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot.):
timelines controllerにおいてindex.htmlがないよ。と言われているのだと解釈しているのですが、あってますでしょうか?
viewsの中にきちんとindex.html.slimファイルがあるのになぜmissing a templateと言われるのでしょうか?
![]
routes.rb
Rails.application.routes.draw do namespace :users do resources :timelines end root to: 'home#index' end
timelines_controller.rb
class Users::TimelinesController < ApplicationController def index end def show end end
テンプレートエンジンにslimを導入しています。
追加事項
Started GET "/users/timelines" for 127.0.0.1 at 2018-02-11 06:32:48 +0900
Processing by Users::TimelinesController#index as HTML
Completed 406 Not Acceptable in 89ms
ActionController::UnknownFormat (Users::TimelinesController#index is missing a template for this request format and variant.
request.formats: ["text/html"]
request.variant: []
NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot.):
回答2件
あなたの回答
tips
プレビュー