LoginSignup
1
3

More than 3 years have passed since last update.

[Rails] Devise でgem' html2slim'を使用した際のエラーについて

Posted at

Deviseを使用した際,「$rails g devise:views」を実行後、
$ bundle exec erb2slim app/views/devise -dを実行した。

その後、「localhost:3000/users/sign_up」に飛んだ際にエラー発生。
スクリーンショット 2020-07-10 23.56.55.png

app/views/devise/shared/_error_messages.html.slim
- if resource.errors.any?
  #error_explanation
    h2
      = I18n.t("errors.messages.not_saved",
      -                  count: resource.errors.count,
      -                  resource: resource.class.model_name.human.downcase

よく見ると slim の構文が間違っている。
-」は埋め込みrubyを記述する際に使用するので、構文がおかしい。
よって、「-」を消去することでエラーが回避された。

感想

エラー内容は単純なものでしたが、自動でファイルの中身を
修正してくれるgemは完璧ではないという事を学べました。

1
3
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
1
3