diff --git a/engines/dfc_provider/app/controllers/dfc_provider/api/base_controller.rb b/engines/dfc_provider/app/controllers/dfc_provider/api/base_controller.rb index 497daf728a..92b9bf0f73 100644 --- a/engines/dfc_provider/app/controllers/dfc_provider/api/base_controller.rb +++ b/engines/dfc_provider/app/controllers/dfc_provider/api/base_controller.rb @@ -32,13 +32,17 @@ module DfcProvider def current_enterprise @current_enterprise ||= - if params[:enterprise_id] == 'default' + if params[enterprise_id_param_name] == 'default' current_user.enterprises.first! else - current_user.enterprises.find(params[:enterprise_id]) + current_user.enterprises.find(params[enterprise_id_param_name]) end end + def enterprise_id_param_name + :enterprise_id + end + def current_user @current_user ||= authorization_control.process end diff --git a/engines/dfc_provider/app/controllers/dfc_provider/api/enterprises_controller.rb b/engines/dfc_provider/app/controllers/dfc_provider/api/enterprises_controller.rb index 7bc7162a68..91cba677bb 100644 --- a/engines/dfc_provider/app/controllers/dfc_provider/api/enterprises_controller.rb +++ b/engines/dfc_provider/app/controllers/dfc_provider/api/enterprises_controller.rb @@ -10,13 +10,8 @@ module DfcProvider private - def current_enterprise - @current_enterprise ||= - if params[:id] == 'default' - current_user.enterprises.first! - else - current_user.enterprises.find(params[:id]) - end + def enterprise_id_param_name + :id end end end