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
Jérome Perrin
gitlab-ce
Commits
474d25e2
Commit
474d25e2
authored
Jul 07, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use variable_params && variable_params_attributes in project variables_controller.rb
parent
4fbfe475
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+8
-4
No files found.
app/controllers/projects/variables_controller.rb
View file @
474d25e2
...
...
@@ -12,7 +12,7 @@ class Projects::VariablesController < Projects::ApplicationController
end
def
update
if
@variable
.
update
(
project
_params
)
if
variable
.
update
(
variable
_params
)
redirect_to
project_variables_path
(
project
),
notice:
'Variable was successfully updated.'
else
...
...
@@ -21,7 +21,7 @@ class Projects::VariablesController < Projects::ApplicationController
end
def
create
@variable
=
project
.
variables
.
create
(
project
_params
)
@variable
=
project
.
variables
.
create
(
variable
_params
)
.
present
(
current_user:
current_user
)
if
@variable
.
persisted?
...
...
@@ -46,8 +46,12 @@ class Projects::VariablesController < Projects::ApplicationController
private
def
project_params
params
.
require
(
:variable
).
permit
([
:id
,
:key
,
:value
,
:protected
,
:_destroy
])
def
variable_params
params
.
require
(
:variable
).
permit
(
*
variable_params_attributes
)
end
def
variable_params_attributes
%i[id key value protected _destroy]
end
def
variable
...
...
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