Commit 779f05ef authored by Douwe Maan's avatar Douwe Maan

Explain skip_before_filter workaround.

parent 3adbb8b1
class Projects::UploadsController < Projects::ApplicationController class Projects::UploadsController < Projects::ApplicationController
layout 'project' layout 'project'
skip_before_filter :authenticate_user!, :reject_blocked!, :project, :repository, only: [:show] # We want to skip these filters for only the `show` action if `image?` is true,
before_filter :authenticate_user!, :reject_blocked!, :project, :repository, only: [:show], unless: :image? # but `skip_before_filter` doesn't work with both `only` and `if`, so we accomplish the same like this.
skipped_filters = [:authenticate_user!, :reject_blocked!, :project, :repository]
skip_before_filter *skipped_filters, only: [:show]
before_filter *skipped_filters, only: [:show], unless: :image?
def create def create
link_to_file = ::Projects::UploadService.new(project, params[:file]). link_to_file = ::Projects::UploadService.new(project, params[:file]).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment