From b80bd744ad873f6fc43018bc4bfb90677de167bd Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 17 Dec 2012 12:01:45 +0100 Subject: Start of GS5. --- app/controllers/addresses_controller.rb | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 app/controllers/addresses_controller.rb (limited to 'app/controllers/addresses_controller.rb') diff --git a/app/controllers/addresses_controller.rb b/app/controllers/addresses_controller.rb new file mode 100644 index 0000000..a70b1f4 --- /dev/null +++ b/app/controllers/addresses_controller.rb @@ -0,0 +1,41 @@ +class AddressesController < ApplicationController + def index + @addresses = Address.all + end + + def show + @address = Address.find(params[:id]) + end + + def new + @address = Address.new + end + + def create + @address = Address.new(params[:address]) + if @address.save + redirect_to @address, :notice => t('addresses.controller.successfuly_created') + else + render :new + end + end + + def edit + @address = Address.find(params[:id]) + end + + def update + @address = Address.find(params[:id]) + if @address.update_attributes(params[:address]) + redirect_to @address, :notice => t('addresses.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @address = Address.find(params[:id]) + @address.destroy + redirect_to addresses_url, :notice => t('addresses.controller.successfuly_destroyed') + end +end -- cgit v1.2.3