Listing 2. order_controller.rb
01 class OrderController < ActionController::Base 02 def list 03 @orders = Order.find_all // Find all orders and set instance variable 04 // framework automatically forwards to list.rhtml 05 end 06 07 def delete 08 id = @params["id"] // Get the order id from the request 09 Order.delete(id) // Delete the order 10 redirect_to :action => "list" // Forward to the list action (list method) 11 end 12 end |