Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
d6624b14d691
Commit
232bdd47
authored
Oct 31, 2017
by
James Lopez
Browse files
refactor code
parent
df60439b0f8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/controllers/admin/applications_controller.rb
View file @
d6624b14
...
...
@@ -19,7 +19,7 @@ def edit
end
def
create
@application
=
Applications
::
CreateService
.
new
(
current_user
,
application_params
.
merge
(
ip_address:
request
.
remote_ip
)).
execute
@application
=
Applications
::
CreateService
.
new
(
current_user
,
application_params
.
merge
.
execute
(
request
)
if
@application
.
persisted?
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
...
...
app/controllers/oauth/applications_controller.rb
View file @
d6624b14
...
...
@@ -16,7 +16,7 @@ def index
end
def
create
@application
=
Applications
::
CreateService
.
new
(
current_user
,
create_application_params
).
execute
@application
=
Applications
::
CreateService
.
new
(
current_user
,
create_application_params
).
execute
(
request
)
if
@application
.
persisted?
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
...
...
@@ -58,7 +58,6 @@ def set_application
def
create_application_params
application_params
.
tap
do
|
params
|
params
[
:owner
]
=
current_user
params
[
:ip_address
]
=
request
.
remote_ip
end
end
end
app/services/applications/create_service.rb
View file @
d6624b14
...
...
@@ -6,7 +6,7 @@ def initialize(current_user, params)
@ip_address
=
@params
.
delete
(
:ip_address
)
end
def
execute
def
execute
(
request
=
nil
)
Doorkeeper
::
Application
.
create
(
@params
)
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