diff options
author | Peter Kozak <spag@golwen.net> | 2013-01-13 16:34:12 +0000 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-01-13 16:34:12 +0000 |
commit | 35d855d7c0d174a77fb5edd2978c2381fad83520 (patch) | |
tree | e2de8ade01f641f723ec61b6d5fba9749e8d13d4 /app/controllers/gateways_controller.rb | |
parent | 983cce30e1f84a4674fa45977076f1a04f0f20db (diff) |
gateway controller
Diffstat (limited to 'app/controllers/gateways_controller.rb')
-rw-r--r-- | app/controllers/gateways_controller.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/controllers/gateways_controller.rb b/app/controllers/gateways_controller.rb new file mode 100644 index 0000000..6173ca3 --- /dev/null +++ b/app/controllers/gateways_controller.rb @@ -0,0 +1,41 @@ +class GatewaysController < ApplicationController + def index + @gateways = Gateway.all + end + + def show + @gateway = Gateway.find(params[:id]) + end + + def new + @gateway = Gateway.new + end + + def create + @gateway = Gateway.new(params[:gateway]) + if @gateway.save + redirect_to @gateway, :notice => t('gateways.controller.successfuly_created') + else + render :new + end + end + + def edit + @gateway = Gateway.find(params[:id]) + end + + def update + @gateway = Gateway.find(params[:id]) + if @gateway.update_attributes(params[:gateway]) + redirect_to @gateway, :notice => t('gateways.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @gateway = Gateway.find(params[:id]) + @gateway.destroy + redirect_to gateways_url, :notice => t('gateways.controller.successfuly_destroyed') + end +end |