summaryrefslogtreecommitdiffstats
path: root/app/controllers/project_enumerations_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/project_enumerations_controller.rb')
-rw-r--r--app/controllers/project_enumerations_controller.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/app/controllers/project_enumerations_controller.rb b/app/controllers/project_enumerations_controller.rb
index f68d94869..d9a77f969 100644
--- a/app/controllers/project_enumerations_controller.rb
+++ b/app/controllers/project_enumerations_controller.rb
@@ -20,15 +20,8 @@ class ProjectEnumerationsController < ApplicationController
before_action :authorize
def update
- if params[:enumerations]
- saved = Project.transaction do
- params[:enumerations].each do |id, activity|
- @project.update_or_create_time_entry_activity(id, activity)
- end
- end
- if saved
- flash[:notice] = l(:notice_successful_update)
- end
+ if @project.update_or_create_time_entry_activities(update_params)
+ flash[:notice] = l(:notice_successful_update)
end
redirect_to settings_project_path(@project, :tab => 'activities')
@@ -41,4 +34,12 @@ class ProjectEnumerationsController < ApplicationController
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'activities')
end
+
+ private
+
+ def update_params
+ params.
+ permit(:enumerations => [:parent_id, :active, {:custom_field_values => {}}]).
+ require(:enumerations)
+ end
end