Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
8955959d65ab
Commit
779f05ef
authored
Apr 17, 2015
by
Douwe Maan
Browse files
Explain skip_before_filter workaround.
parent
7912581b06db
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/projects/uploads_controller.rb
View file @
8955959d
class
Projects::UploadsController
<
Projects
::
ApplicationController
layout
'project'
skip_before_filter
:authenticate_user!
,
:reject_blocked!
,
:project
,
:repository
,
only:
[
:show
]
before_filter
:authenticate_user!
,
:reject_blocked!
,
:project
,
:repository
,
only:
[
:show
],
unless: :image?
# We want to skip these filters for only the `show` action if `image?` is true,
# 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
link_to_file
=
::
Projects
::
UploadService
.
new
(
project
,
params
[
:file
]).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment