#53: some refactoring according to discussion
This commit is contained in:
parent
e7b07cdfca
commit
c9b04a6acc
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue