Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
63e37479
Commit
63e37479
authored
Jun 01, 2017
by
Chrysanthi Lagodimou
Committed by
Tuğçe Nur Taş
Jun 02, 2017
Browse files
dry volunteer authorization
parent
a0b62ac8
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/volunteers_controller.rb
View file @
63e37479
...
...
@@ -8,9 +8,7 @@ class VolunteersController < ApplicationController
authorize
Volunteer
end
def
show
authorize
@volunteer
end
def
show
;
end
def
new
@volunteer
=
Volunteer
.
new
...
...
@@ -18,9 +16,7 @@ class VolunteersController < ApplicationController
authorize
@volunteer
end
def
edit
authorize
@volunteer
end
def
edit
;
end
def
create
@volunteer
=
Volunteer
.
new
(
volunteer_params
)
...
...
@@ -33,7 +29,6 @@ class VolunteersController < ApplicationController
end
def
update
authorize
@volunteer
if
@volunteer
.
update
(
volunteer_params
)
if
@state
==
Volunteer
::
INTERESTED
&&
@volunteer
.
state
==
Volunteer
::
ACCEPTED
new_user
=
User
.
new
(
email:
@volunteer
.
email
,
...
...
@@ -50,7 +45,6 @@ class VolunteersController < ApplicationController
end
def
destroy
authorize
@volunteer
@volunteer
.
destroy
redirect_to
volunteers_url
,
notice:
t
(
'volunteer_destroyed'
)
end
...
...
@@ -63,6 +57,7 @@ class VolunteersController < ApplicationController
def
set_volunteer
@volunteer
=
Volunteer
.
find
(
params
[
:id
])
authorize
@volunteer
end
def
volunteer_params
...
...
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