Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-07 09:52:25 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-04-07 17:17:27 +0300
commit76c0364ca52ce0b777f2ddb277fe666d95392256 (patch)
tree8923dd63370e13a5c769a438c7769cc4120118f1 /app/controllers/projects/triggers_controller.rb
parent2548c155eed13c806951a6303c85dbb0c5772ca3 (diff)
Use allow_destroy. Remove condtion from form.haml.
Diffstat (limited to 'app/controllers/projects/triggers_controller.rb')
-rw-r--r--app/controllers/projects/triggers_controller.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/controllers/projects/triggers_controller.rb b/app/controllers/projects/triggers_controller.rb
index 5ceeeb1c454..2a3c563890b 100644
--- a/app/controllers/projects/triggers_controller.rb
+++ b/app/controllers/projects/triggers_controller.rb
@@ -16,6 +16,7 @@ class Projects::TriggersController < Projects::ApplicationController
if @trigger.valid?
flash[:notice] = 'Trigger was created successfully.'
else
+ puts "@trigger.errors: #{@trigger.errors.inspect}"
flash[:alert] = 'You could not create a new trigger.'
end
@@ -33,6 +34,7 @@ class Projects::TriggersController < Projects::ApplicationController
end
def edit
+ @trigger.build_trigger_schedule unless @trigger.trigger_schedule.present?
end
def update
@@ -69,15 +71,15 @@ class Projects::TriggersController < Projects::ApplicationController
def create_params
params.require(:trigger).permit(
- :description, :ref, :trigger_schedule_on,
- trigger_schedule_attributes: [ :cron, :cron_timezone ]
+ :description, :ref,
+ trigger_schedule_attributes: [ :cron, :cron_timezone, :_destroy ]
)
end
def update_params
params.require(:trigger).permit(
- :description, :ref, :trigger_schedule_on,
- trigger_schedule_attributes: [ :cron, :cron_timezone ]
+ :description, :ref,
+ trigger_schedule_attributes: [ :cron, :cron_timezone, :_destroy ]
)
end
end