curriculum icon indicating copy to clipboard operation
curriculum copied to clipboard

Form Basics uses depreciated form_tag and form_for methods

Open vedantshetty opened this issue 7 years ago • 4 comments

The lesson on form basics(link) teaches the now depreciated form_tag and form_for methods to generate forms.

Rails recommends us to use form_with instead(link)

vedantshetty avatar Dec 06 '19 09:12 vedantshetty

The entire curriculum still uses Rails 5 where, if I'm not mistaken, form_tag and form_for are the way to go. I think this is something that's going to be changed once the curriculum switches to Rails 6 :)

dvik1950 avatar Dec 11 '19 22:12 dvik1950

Actually form_with was introduced in rails 5.1.

I just wanted to note down some of the obsolete code

vedantshetty avatar Dec 12 '19 08:12 vedantshetty

Another point: If you decide to use form_with instead of form_tag/ form_for in the projects. Your errors are not going to show up.

This is because of how form_with works. To display errors add parameter local: true in your form_with declaration.

I faced the same problem and answered it on stack overflow here

vedantshetty avatar Dec 15 '19 12:12 vedantshetty

This needs some more review, thank you for bringing this up @vedantshetty

I3uckwheat avatar Apr 16 '20 04:04 I3uckwheat