summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/call_routes_controller.rb9
-rw-r--r--app/controllers/gs_parameters_controller.rb8
-rw-r--r--app/models/call_route.rb7
3 files changed, 15 insertions, 9 deletions
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb
index 130a160..89f66ba 100644
--- a/app/controllers/call_routes_controller.rb
+++ b/app/controllers/call_routes_controller.rb
@@ -15,7 +15,7 @@ class CallRoutesController < ApplicationController
end
def create
- @call_route = CallRoute.new(params[:call_route])
+ @call_route = CallRoute.new(call_route_parameter_params[:call_route])
if @call_route.save
redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created')
else
@@ -27,7 +27,7 @@ class CallRoutesController < ApplicationController
end
def update
- if @call_route.update_attributes(params[:call_route])
+ if @call_route.update_attributes(call_route_parameter_params[:call_route])
redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated')
else
render :edit
@@ -40,6 +40,10 @@ class CallRoutesController < ApplicationController
end
private
+ def call_route_parameter_params
+ params.require(:call_route).permit(:id, :routing_table, :name, :endpoint_type, :endpoint_id, :position)
+ end
+
def spread_breadcrumbs
add_breadcrumb t("call_routes.index.page_title"), call_routes_path
if @call_route && !@call_route.new_record?
@@ -47,4 +51,5 @@ class CallRoutesController < ApplicationController
end
end
+
end
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb
index 7ca4e8e..3c212c1 100644
--- a/app/controllers/gs_parameters_controller.rb
+++ b/app/controllers/gs_parameters_controller.rb
@@ -10,7 +10,7 @@ class GsParametersController < ApplicationController
end
def show
- @gs_parameter = GsParameter.find(params[:id])
+ @gs_parameter = GsParameter.find(gs_parameter_params[:id])
end
def new
@@ -18,11 +18,11 @@ class GsParametersController < ApplicationController
end
def edit
- @gs_parameter = GsParameter.find(params[:id])
+ @gs_parameter = GsParameter.find(gs_parameter_params[:id])
end
def update
- @gs_parameter = GsParameter.find(params[:id])
+ @gs_parameter = GsParameter.find(gs_parameter_params[:id])
if @gs_parameter.update_attributes(gs_parameter_params)
redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated')
else
@@ -32,7 +32,7 @@ class GsParametersController < ApplicationController
private
def gs_parameter_params
- params.require(:gs_parameter).permit(:value, :class_type, :description)
+ params.require(:gs_parameter).permit(:id, :value, :class_type, :description)
end
def spread_breadcrumbs
diff --git a/app/models/call_route.rb b/app/models/call_route.rb
index 0df961d..5d90901 100644
--- a/app/models/call_route.rb
+++ b/app/models/call_route.rb
@@ -1,14 +1,15 @@
class CallRoute < ActiveRecord::Base
- ROUTING_TABLES = ['prerouting', 'outbound', 'inbound']
+ # https://github.com/rails/strong_parameters
+ include ActiveModel::ForbiddenAttributesProtection
- attr_accessible :routing_table, :name, :endpoint_type, :endpoint_id, :position
+ ROUTING_TABLES = ['prerouting', 'outbound', 'inbound']
has_many :route_elements, :dependent => :destroy
validates :name,
:presence => true
- validates :table,
+ validates :routing_table,
:presence => true,
:inclusion => { :in => ROUTING_TABLES }