From c9b04a6acc33b42192a45de0d3c439e9bc445543 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 2 Apr 2013 15:04:51 +0400 Subject: [PATCH] #53: some refactoring according to discussion --- app/controllers/api/v1/build_lists_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/build_lists_controller.rb b/app/controllers/api/v1/build_lists_controller.rb index 78817f9c5..ee46406ce 100644 --- a/app/controllers/api/v1/build_lists_controller.rb +++ b/app/controllers/api/v1/build_lists_controller.rb @@ -34,6 +34,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController def publish @build_list.publisher = current_user + @build_list.save render_json :publish end @@ -48,7 +49,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController private def render_json(action_name, action_method = nil) - if @build_list.save && @build_list.try("can_#{action_name}?") && @build_list.send(action_method || action_name) + if @build_list.try("can_#{action_name}?") && @build_list.send(action_method || action_name) render_json_response @build_list, t("layout.build_lists.#{action_name}_success") else render_validation_error @build_list, t("layout.build_lists.#{action_name}_fail")