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?

Thanks,

Joe

On 24 May 2015 at 19:48, [email protected] [email protected] wrote:

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.

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

Colin

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/