rubocop-rails icon indicating copy to clipboard operation
rubocop-rails copied to clipboard

New cop: Prefer form_with over form_for/form_tag

Open alexsanderson opened this issue 4 years ago • 2 comments

As form_with has been introduced to replace form_for and form_tag (https://github.com/rails/rails/issues/25197), how about a cop to check for the older tags and encourage use of the newer tag?

I'd like this cop, but I wanted to gauge everyone else's opinion before looking at a PR.

alexsanderson avatar Apr 29 '20 12:04 alexsanderson

Perhaps also worth an entry in https://github.com/rubocop-hq/rails-style-guide

andyw8 avatar Apr 29 '20 22:04 andyw8

AFAIK, form_for and form_tag are not deprecated warning message yet. It would be better to respond after the deprecated warning message will be introduced. I've talked to a Rails committer @y-yagi about these APIs in the past and I agree with that idea . So I think that it's still too early.

koic avatar May 20 '20 02:05 koic

I'm going to close this issue because RuboCop Rails currently has no plans to support template engines like ERB, Haml, and so on. Thank you for sharing this idea.

koic avatar Mar 29 '23 16:03 koic