Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
efcdc269
Commit
efcdc269
authored
Feb 06, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix static_analysis failure
parent
d05cc9c6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
app/controllers/groups/variables_controller.rb
app/controllers/groups/variables_controller.rb
+12
-4
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+10
-2
No files found.
app/controllers/groups/variables_controller.rb
View file @
efcdc269
...
@@ -11,20 +11,28 @@ module Groups
...
@@ -11,20 +11,28 @@ module Groups
end
end
def
update
def
update
if
@group
.
update
(
variables_params
)
if
@group
.
update
(
group_
variables_params
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
{
return
render
status: :ok
,
json:
{
variables:
GroupVariableSerializer
.
new
.
represent
(
@group
.
variables
)
}
}
format
.
json
{
return
render
_group_variables
}
end
end
else
else
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
{
render
status: :bad_request
,
json:
@group
.
errors
.
full_messages
}
format
.
json
{
render
_error
}
end
end
end
end
end
end
private
private
def
variables_params
def
render_group_variables
render
status: :ok
,
json:
{
variables:
GroupVariableSerializer
.
new
.
represent
(
@group
.
variables
)
}
end
def
render_error
render
status: :bad_request
,
json:
@group
.
errors
.
full_messages
end
def
group_variables_params
params
.
permit
(
variables_attributes:
[
*
variable_params_attributes
])
params
.
permit
(
variables_attributes:
[
*
variable_params_attributes
])
end
end
...
...
app/controllers/projects/variables_controller.rb
View file @
efcdc269
...
@@ -12,17 +12,25 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -12,17 +12,25 @@ class Projects::VariablesController < Projects::ApplicationController
def
update
def
update
if
@project
.
update
(
variables_params
)
if
@project
.
update
(
variables_params
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
{
return
render
status: :ok
,
json:
{
variables:
VariableSerializer
.
new
.
represent
(
@project
.
variables
)
}
}
format
.
json
{
return
render
_variables
}
end
end
else
else
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
{
render
status: :bad_request
,
json:
@project
.
errors
.
full_messages
}
format
.
json
{
render
_error
}
end
end
end
end
end
end
private
private
def
render_variables
render
status: :ok
,
json:
{
variables:
VariableSerializer
.
new
.
represent
(
@project
.
variables
)
}
end
def
render_error
render
status: :bad_request
,
json:
@project
.
errors
.
full_messages
end
def
variables_params
def
variables_params
params
.
permit
(
variables_attributes:
[
*
variable_params_attributes
])
params
.
permit
(
variables_attributes:
[
*
variable_params_attributes
])
end
end
...
...
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