#698: renamed method

This commit is contained in:
Vokhmin Alexey V 2012-10-18 20:36:29 +04:00
parent 8bbb82faa8
commit 5cf69bff92
1 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController
def create
@advisory = @build_list.build_and_associate_advisory(params[:advisory])
if may_be_published? && @advisory.save && @build_list.save
if can_attach? && @advisory.save && @build_list.save
render_json_response @advisory, 'Advisory has been created successfully'
else
render_validation_error @advisory, error_message(@build_list, 'Advisory has not been created')
@ -25,7 +25,7 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController
end
def update
if @advisory && may_be_published?
if @advisory && can_attach?
@advisory.attach_build_list(@build_list) &&
@advisory.save && @build_list.save
render_json_response @advisory, "Build list '#{@build_list.id}' has been attached to advisory successfully"
@ -40,7 +40,7 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController
@build_list = BuildList.find params[:build_list_id]
end
def may_be_published?
def can_attach?
!@build_list.save_to_repository.publish_without_qa &&
can?(:update, @build_list.save_to_platform) &&
@build_list.save_to_platform.released &&