TutorialHelperMethods | Tutorial | TutorialRelationalForms
Let’s get the rest of the scaffolding methods fleshed out, frame in, built up… whatever you want to call it. Ok, I cheated and looked at the documentation for the Scaffolding, and it lists some basic code for the various methods. Since destroy and update are so easy, I pretty much copied them over to my friends_controller.rb.
def update @person = Person.find(@params["person"]["id"]) @person.attributes = @params["person"] if @person.save redirect_to :action => "show", :id => @person.id else render "person/edit" end end def destroy Person.find(@params["id"]).destroy redirect_to :action => "list" end
TutorialHelperMethods | Tutorial | TutorialRelationalForms
category:Tutorial