kaiho/app/controllers/github_repository_controller.rb

22 lines
653 B
Ruby
Raw Permalink Normal View History

2018-07-29 19:06:32 +00:00
class GithubRepositoryController < ApplicationController
def create
@software = Software.find(params[:software_id])
2018-08-05 10:37:03 +00:00
if @software.id == params[:repository][:software_id].to_i
@repository = GithubRepository.new(params.require(:repository).permit(:software_id, :name))
@repository.save
end
2018-07-29 19:06:32 +00:00
redirect_to edit_software_path(@software)
end
def update
@software = Software.find(params[:software_id])
@repository = GithubRepository.find(params[:id])
2018-07-29 19:06:32 +00:00
@repository.update(params.require(:repository).permit(:name)) if @software.id == @repository.software_id
2018-07-29 19:06:32 +00:00
redirect_to edit_software_path(@software)
2018-07-29 19:06:32 +00:00
end
end