21 lines
653 B
Ruby
21 lines
653 B
Ruby
class GithubRepositoryController < ApplicationController
|
|
def create
|
|
@software = Software.find(params[:software_id])
|
|
|
|
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
|
|
|
|
def update
|
|
@software = Software.find(params[:software_id])
|
|
@repository = GithubRepository.find(params[:id])
|
|
|
|
@repository.update(params.require(:repository).permit(:name)) if @software.id == @repository.software_id
|
|
|
|
redirect_to edit_software_path(@software)
|
|
end
|
|
end
|