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

Duane Johnson duane.johnson at gmail.com
Wed Jan 19 00:57:43 GMT 2005


So I've finally figured out how to make simple and elegant
Create/Read/Update/Delete events for a single object such as @person. 
But how do the Rails experts do it for a list of objects?

For example:

class TestController < ApplicationController
  def list
    @people = Person.find_all
  end
end

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?

Thank-you,
Duane Johnson
(canadaduane)


More information about the Rails mailing list