Commit fb8c49db authored by Shinya Maeda's avatar Shinya Maeda Committed by Kamil Trzcinski

create_params and update_params into trigger_params

parent 2f5095c2
......@@ -11,7 +11,7 @@ class Projects::TriggersController < Projects::ApplicationController
end
def create
@trigger = project.triggers.create(create_params.merge(owner: current_user))
@trigger = project.triggers.create(trigger_params.merge(owner: current_user))
if @trigger.valid?
flash[:notice] = 'Trigger was created successfully.'
......@@ -37,7 +37,7 @@ class Projects::TriggersController < Projects::ApplicationController
end
def update
if trigger.update(update_params)
if trigger.update(trigger_params)
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project), notice: 'Trigger was successfully updated.'
else
render action: "edit"
......@@ -68,17 +68,10 @@ class Projects::TriggersController < Projects::ApplicationController
@trigger ||= project.triggers.find(params[:id]) || render_404
end
def create_params
def trigger_params
params.require(:trigger).permit(
:description, :ref,
trigger_schedule_attributes: [ :cron, :cron_timezone, :_destroy ]
)
end
def update_params
params.require(:trigger).permit(
:description, :ref,
trigger_schedule_attributes: [ :cron, :cron_timezone, :_destroy ]
trigger_schedule_attributes: [:cron, :cron_timezone, :_destroy]
)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment