kaiho/app/controllers/github_repository_controller.rb

23 lines
574 B
Ruby

class GithubRepositoryController < ApplicationController
def create
@software = Software.find(params[:software_id])
@repository = GithubRepository.new(repository_params)
@repository.save
redirect_to edit_software_path(@software)
end
def update
@software = Software.find(params[:software_id])
@repository = GithubRepository.find(params[:id])
@repository.update(repository_params)
redirect_to edit_software_path(@software)
end
private
def repository_params
params.require(:repository).permit(:name, :software_id)
end
end