Commit 5891161b095cfce15044093883963ee02022f527
1 parent
4dc573e8
Exists in
colab
and in
4 other branches
set_project sets the project_image as well
Showing
1 changed file
with
1 additions
and
4 deletions
Show diff stats
app/controllers/projects_controller.rb
... | ... | @@ -32,20 +32,16 @@ class ProjectsController < ApplicationController |
32 | 32 | def show |
33 | 33 | set_project |
34 | 34 | @project_repositories = @project.repositories |
35 | - @project_image = ProjectImage.find_by_project_id(@project.id) | |
36 | 35 | end |
37 | 36 | |
38 | 37 | # GET /projects/1/edit |
39 | 38 | # GET /projects/1/edit.json |
40 | 39 | def edit |
41 | 40 | set_project |
42 | - @project_image = ProjectImage.find_by_project_id(@project.id) | |
43 | - #@project_image ? @project_image.check_no_image : ProjectImage.new | |
44 | 41 | end |
45 | 42 | |
46 | 43 | def update |
47 | 44 | set_project |
48 | - @project_image = ProjectImage.find_by_project_id(@project.id) | |
49 | 45 | image_url = project_params.delete(:image_url) |
50 | 46 | if @project.update(project_params) && @project_image.update(url: image_url) |
51 | 47 | redirect_to(project_path(@project.id)) |
... | ... | @@ -70,6 +66,7 @@ class ProjectsController < ApplicationController |
70 | 66 | # Use callbacks to share common setup or constraints between actions. |
71 | 67 | def set_project |
72 | 68 | @project = Project.find(params[:id]) |
69 | + @project_image = ProjectImage.find_by_project_id(@project.id) | |
73 | 70 | end |
74 | 71 | |
75 | 72 | # Never trust parameters from the scary internet, only allow the white list through. | ... | ... |