fix: params in new github_repository

This commit is contained in:
Adrien Waksberg 2018-08-05 12:37:03 +02:00
parent 78a248286f
commit b9e8dc5ef2

View file

@ -1,8 +1,11 @@
class GithubRepositoryController < ApplicationController class GithubRepositoryController < ApplicationController
def create def create
@software = Software.find(params[:software_id]) @software = Software.find(params[:software_id])
@repository = GithubRepository.new(params.permit(:name, :software_id))
if @software.id == params[:repository][:software_id].to_i
@repository = GithubRepository.new(params.require(:repository).permit(:software_id, :name))
@repository.save @repository.save
end
redirect_to edit_software_path(@software) redirect_to edit_software_path(@software)
end end