summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-18 10:19:09 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-18 10:19:09 +0100
commit5efd9bdd2f78a15569fb7d1569dceff3bb4f8800 (patch)
treef673fa35c56406b8b1dd664acd4262e4dbd6c2c9
parentf4abcadbee2dac3f2d8e4dc710af364300aa41bf (diff)
Fixed a strange strong_parameter cancan bug.
-rw-r--r--app/controllers/call_routes_controller.rb13
-rw-r--r--app/views/call_routes/_form_core.html.haml2
2 files changed, 8 insertions, 7 deletions
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb
index 89f66ba..8b8698f 100644
--- a/app/controllers/call_routes_controller.rb
+++ b/app/controllers/call_routes_controller.rb
@@ -1,6 +1,4 @@
class CallRoutesController < ApplicationController
- load_and_authorize_resource :call_route
-
before_filter :spread_breadcrumbs
def index
@@ -9,13 +7,15 @@ class CallRoutesController < ApplicationController
end
def show
+ @call_route = CallRoute.find(params[:id])
end
def new
+ @call_route = CallRoute.new
end
def create
- @call_route = CallRoute.new(call_route_parameter_params[:call_route])
+ @call_route = CallRoute.new(call_route_parameter_params)
if @call_route.save
redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created')
else
@@ -27,7 +27,8 @@ class CallRoutesController < ApplicationController
end
def update
- if @call_route.update_attributes(call_route_parameter_params[:call_route])
+ @call_route = CallRoute.find(params[:id])
+ if @call_route.update_attributes(call_route_parameter_params)
redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated')
else
render :edit
@@ -35,13 +36,14 @@ class CallRoutesController < ApplicationController
end
def destroy
+ @call_route = CallRoute.find(params[:id])
@call_route.destroy
redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed')
end
private
def call_route_parameter_params
- params.require(:call_route).permit(:id, :routing_table, :name, :endpoint_type, :endpoint_id, :position)
+ params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id)
end
def spread_breadcrumbs
@@ -51,5 +53,4 @@ class CallRoutesController < ApplicationController
end
end
-
end
diff --git a/app/views/call_routes/_form_core.html.haml b/app/views/call_routes/_form_core.html.haml
index 2eee795..b64d660 100644
--- a/app/views/call_routes/_form_core.html.haml
+++ b/app/views/call_routes/_form_core.html.haml
@@ -1,5 +1,5 @@
.inputs
- = f.input :routing_table, :collection => CallRoute::ROUTING_TABLES, :label => t('call_routes.form.table.label'), :hint => conditional_hint('call_routes.form.table.hint'), :include_blank => false
+ = f.input :routing_table, :collection => CallRoute::ROUTING_TABLES, :label => t('call_routes.form.table.label'), :hint => conditional_hint('call_routes.form.table.hint'), :include_blank => false, :autofocus => true
= f.input :name, :label => t('call_routes.form.name.label'), :hint => conditional_hint('call_routes.form.name.hint')
= f.input :endpoint_type, :label => t('call_routes.form.endpoint_type.label'), :hint => conditional_hint('call_routes.form.endpoint_type.hint')
= f.input :endpoint_id, :label => t('call_routes.form.endpoint_id.label'), :hint => conditional_hint('call_routes.form.endpoint_id.hint')