11
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

-初心者でもわかるエラー解決-ActionController::UnknownFormat in 〇〇Controller#アクション名

Posted at

ActionController::UnknownFormat in 〇〇Controller#アクション名の解決方法

自分の備忘録として、エラーの解決方法を記載していこうと思います!

ActionController::UnknownFormat in 〇〇Controller#アクション名

エラーの本文はこんな感じ。

〇〇Controller#アクション名 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.

Extracted source (around line #55):
53 "That's what you'll get from an XHR or API request. Give it a shot."
54 raise ActionController::UnknownFormat, message
55 else
56 logger.info "No template found for #{self.class.name}##{action_name},
57 rendering head :no_content" if logger
58 super

・・・こんなところいじった覚えはない。。。

ただ、ここがヒントかなと思います。

missing a template for this request format

リクエストされたフォーマットに対して、テンプレートがないと言われています。
・・・ビューファイルをまだ作っていないことで発生していたエラーのようです。

アプリを作り始めた時にこのエラーがでた場合は焦ることなくビューの実装を行いましょう!

11
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?