fix: verify software_id before save change of a gitub repository
This commit is contained in:
parent
5d948b79bd
commit
4e62cb6593
1 changed files with 10 additions and 6 deletions
|
@ -1,16 +1,20 @@
|
||||||
class GithubRepositoryController < ApplicationController
|
class GithubRepositoryController < ApplicationController
|
||||||
def create
|
def create
|
||||||
|
if params[:repository][:software_id] == params[:software_id]
|
||||||
@software = Software.find(params[:software_id])
|
@software = Software.find(params[:software_id])
|
||||||
@repository = GithubRepository.new(repository_params)
|
@repository = GithubRepository.new(repository_params)
|
||||||
@repository.save
|
@repository.save
|
||||||
|
end
|
||||||
|
|
||||||
redirect_to edit_software_path(@software)
|
redirect_to edit_software_path(@software)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
if params[:repository][:software_id] == params[:software_id]
|
||||||
@software = Software.find(params[:software_id])
|
@software = Software.find(params[:software_id])
|
||||||
@repository = GithubRepository.find(params[:id])
|
@repository = GithubRepository.find(params[:id])
|
||||||
@repository.update(repository_params)
|
@repository.update(repository_params)
|
||||||
|
end
|
||||||
|
|
||||||
redirect_to edit_software_path(@software)
|
redirect_to edit_software_path(@software)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue