uploads_controller.rb 493 Bytes
Newer Older
1
class Projects::UploadsController < Projects::ApplicationController
2 3
  include UploadsActions

4 5
  skip_before_action :project, :repository,
    if: -> { action_name == 'show' && image_or_video? }
6

Douwe Maan's avatar
Douwe Maan committed
7
  before_action :authorize_upload_file!, only: [:create]
Douwe Maan's avatar
Douwe Maan committed
8 9 10

  private

Jarka Kadlecova's avatar
Jarka Kadlecova committed
11 12 13 14
  def show_model
    strong_memoize(:show_model) do
      namespace = params[:namespace_id]
      id = params[:project_id]
Douwe Maan's avatar
Douwe Maan committed
15

Jarka Kadlecova's avatar
Jarka Kadlecova committed
16
      Project.find_by_full_path("#{namespace}/#{id}")
Douwe Maan's avatar
Douwe Maan committed
17
    end
18 19 20
  end

  alias_method :model, :project
Douwe Maan's avatar
Douwe Maan committed
21
end