Sha256: acf01c4c4d5a544e39235206e6069e5b5e06da5a34ab7b6ca6e405b03d9dc43c
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
class AddressController < ApplicationController verify :only => [ 'show', 'edit', 'destroy' ], :params => :id, :add_flash => { :notice => 'Missing address ID.' }, :redirect_to => { :action => 'list' } def destroy if request.post? Address.find(params[:id]).destroy flash[:notice] = 'The address was successfully destroyed.' redirect_to :action => 'list' else flash[:notice] = 'Click Destroy to destroy the address.' redirect_to :action => 'edit', :id => params[:id] end end def edit if request.post? @address = Address.find(params[:id]) if @address.update_attributes(params[:address]) flash[:notice] = 'The address was successfully edited.' redirect_to :action => 'show', :id => @address end else @address = Address.find(params[:id]) end end def list @address_pages, @addresses = paginate(:addresses) end def new if request.post? @address = Address.new(params[:address]) if @address.save flash[:notice] = 'A new address was successfully added.' redirect_to :action => 'list' end else @address = Address.new end end def show @address = Address.find(params[:id]) end end
Version data entries
6 entries across 6 versions & 1 rubygems