Commit be93009c2898dcb386746146493eae88e1c4f1d9
1 parent
29969142
Exists in
colab
and in
4 other branches
Processing after repository creation
Showing
2 changed files
with
15 additions
and
11 deletions
Show diff stats
app/controllers/repositories_controller.rb
| 1 | 1 | class RepositoriesController < ApplicationController |
| 2 | 2 | before_action :set_repository, only: [:show, :edit, :update, :destroy] |
| 3 | + after_action :process_respository, only: :create | |
| 3 | 4 | |
| 4 | 5 | # GET /projects/1/repositories/1 |
| 5 | 6 | # GET /projects/1/repositories/1.json |
| ... | ... | @@ -65,14 +66,19 @@ class RepositoriesController < ApplicationController |
| 65 | 66 | end |
| 66 | 67 | end |
| 67 | 68 | |
| 68 | - private | |
| 69 | - # Use callbacks to share common setup or constraints between actions. | |
| 70 | - def set_repository | |
| 71 | - @repository = Repository.find(params[:id].to_i) | |
| 72 | - end | |
| 69 | +private | |
| 70 | + # Use callbacks to share common setup or constraints between actions. | |
| 71 | + def set_repository | |
| 72 | + @repository = Repository.find(params[:id].to_i) | |
| 73 | + end | |
| 73 | 74 | |
| 74 | - # Never trust parameters from the scary internet, only allow the white list through. | |
| 75 | - def repository_params | |
| 76 | - params[:repository] | |
| 77 | - end | |
| 75 | + # Never trust parameters from the scary internet, only allow the white list through. | |
| 76 | + def repository_params | |
| 77 | + params[:repository] | |
| 78 | + end | |
| 79 | + | |
| 80 | + # Start to process a repository | |
| 81 | + def process_respository | |
| 82 | + @repository.process if @repository.persisted? | |
| 83 | + end | |
| 78 | 84 | end | ... | ... |
app/models/repository.rb