diff options
Diffstat (limited to 'app/controllers/gateway_settings_controller.rb')
-rw-r--r-- | app/controllers/gateway_settings_controller.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb index 04af795..5d9f7e5 100644 --- a/app/controllers/gateway_settings_controller.rb +++ b/app/controllers/gateway_settings_controller.rb @@ -3,6 +3,7 @@ class GatewaySettingsController < ApplicationController load_and_authorize_resource :gateway_setting, :through => [:gateway] def index + @gateway_settings = @gateway.gateway_settings end def show @@ -13,30 +14,30 @@ class GatewaySettingsController < ApplicationController end def create - @gateway_setting = GatewaySetting.new(params[:gateway_setting]) + @gateway_setting = @gateway.gateway_settings.build(params[:gateway_setting]) if @gateway_setting.save - redirect_to @gateway_setting, :notice => t('gateway_settings.controller.successfuly_created') + redirect_to [@gateway, @gateway_setting], :notice => t('gateway_settings.controller.successfuly_created') else render :new end end def edit - @gateway_setting = GatewaySetting.find(params[:id]) + @gateway_setting = @gateway.gateway_settings.find(params[:id]) end def update - @gateway_setting = GatewaySetting.find(params[:id]) + @gateway_setting = @gateway.gateway_settings.find(params[:id]) if @gateway_setting.update_attributes(params[:gateway_setting]) - redirect_to @gateway_setting, :notice => t('gateway_settings.controller.successfuly_updated') + redirect_to [@gateway, @gateway_setting], :notice => t('gateway_settings.controller.successfuly_updated') else render :edit end end def destroy - @gateway_setting = GatewaySetting.find(params[:id]) + @gateway_setting = @gateway.gateway_settings.find(params[:id]) @gateway_setting.destroy - redirect_to gateway_settings_url, :notice => t('gateway_settings.controller.successfuly_destroyed') + redirect_to gateway_gateway_settings_path(@gateway), :notice => t('gateway_settings.controller.successfuly_destroyed') end end |