Displaying form data, then editing it in place.

I wrote some pretty ugly code that allows me to pull data from a database and view it. If I wanted to edit/update any of the data, I push the ‘edit’ button at the bottom of the page and the page updates with all text fields replaced with editable form fields.

I always felt like I was reinventing the wheel. Surely, someone else has written a gem to do this?

Any ideas?



What is ugly about the code you have written? Is what you describe not the normal view page and edit page?


Take a look at the best_in_place gem. It works similiar to what you describe.

X-editable is pretty good for this http://vitalets.github.io/x-editable/