From b9e8dc5ef29ea4aa43c400c174d1f5101937d106 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Sun, 5 Aug 2018 12:37:03 +0200 Subject: [PATCH] fix: params in new github_repository --- app/controllers/github_repository_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/github_repository_controller.rb b/app/controllers/github_repository_controller.rb index 1741b4f..ef78c7b 100644 --- a/app/controllers/github_repository_controller.rb +++ b/app/controllers/github_repository_controller.rb @@ -1,8 +1,11 @@ class GithubRepositoryController < ApplicationController def create @software = Software.find(params[:software_id]) - @repository = GithubRepository.new(params.permit(:name, :software_id)) - @repository.save + + if @software.id == params[:repository][:software_id].to_i + @repository = GithubRepository.new(params.require(:repository).permit(:software_id, :name)) + @repository.save + end redirect_to edit_software_path(@software) end