0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Rails7】button_toの挙動の変更の対応

Posted at

問題

Rails6.1までは、button_toで生成されるHTMLはinputタグでしたが、Rails7からbutton_toでHTMLのbuttonタグが生成されるようになりました。
これにより、アップデート前に設定していたinputタグのCSSやJavaScriptが効かなくなります。

解決方法

CSSなどのinputタグをbuttonタグに変更することで対応できますが、以下の設定をconfig/application.rbに入れることで、button_toがRails6.1までの挙動に戻ります。

class Application < Rails::Application
  config.action_view.button_to_generates_button_tag = false
end

参考

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?