[Rails] A "Rails" way to design a list-like page with CRUD capabilities?

Carl Youngblood carlwork at ycs.biz
Fri Jan 21 23:06:47 GMT 2005


Duane Johnson wrote:

>The corresponding list.rhtml view will elegantly display the array of
>Person objects.  But what if each "Person" row in the view is
>editable?  For example, the view I am imagining would generate a text
>box for the first name, last name and phone number, all the way down
>the list, and a check box next to each person to delete the
>corresponding person from the database.  Is there an elegant solution
>to this pattern in Rails?  Any sample code from those of you who've
>come across this and solved it before?
>
I think it would be even better to leave the list as plain text but add 
an edit link next to each person.  When clicked on, the edit link would 
change the HTML dynamically so that what previously appeared as plain 
text now appears as HTML inputs, and when the save button is clicked, 
the editing is saved in the database using XmlHttpRequest and the HTML 
inputs change back to plain text without having to refresh the page.  
This would be the way a next-generation Gmail-like web app would do things.

Carl


More information about the Rails mailing list