kaiho/app/controllers/github_repository_controller.rb

28 lines
732 B
Ruby
Raw Normal View History

2018-07-29 21:06:32 +02:00
class GithubRepositoryController < ApplicationController
def create
if params[:repository][:software_id] == params[:software_id]
@software = Software.find(params[:software_id])
@repository = GithubRepository.new(repository_params)
@repository.save
end
2018-07-29 21:06:32 +02:00
redirect_to edit_software_path(@software)
end
def update
if params[:repository][:software_id] == params[:software_id]
@software = Software.find(params[:software_id])
@repository = GithubRepository.find(params[:id])
@repository.update(repository_params)
end
2018-07-29 21:06:32 +02:00
redirect_to edit_software_path(@software)
end
private
def repository_params
params.require(:repository).permit(:name, :software_id)
end
end