kaiho/app/controllers/github_repository_controller.rb

18 lines
557 B
Ruby

class GithubRepositoryController < ApplicationController
def create
@software = Software.find(params[:software_id])
@repository = GithubRepository.new(params.permit(:name, :software_id))
@repository.save
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