uypdated keys controller logic
This commit is contained in:
parent
72b7b10d52
commit
d0546e6d81
|
@ -11,10 +11,10 @@ class Profiles::KeysController < Profiles::ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@key = Keys::CreateService.new(current_user, key_params).execute
|
||||
@key = Keys::CreateService.new(current_user, key_params.merge(ip_address: request.remote_ip)).execute
|
||||
|
||||
if @key.persisted?
|
||||
redirect_to_profile_key_path
|
||||
redirect_to profile_key_path(@key)
|
||||
else
|
||||
@keys = current_user.keys.select(&:persisted?)
|
||||
render :index
|
||||
|
@ -50,12 +50,6 @@ class Profiles::KeysController < Profiles::ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def redirect_to_profile_key_path
|
||||
redirect_to profile_key_path(@key)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def key_params
|
||||
|
|
|
@ -4,6 +4,7 @@ module Keys
|
|||
|
||||
def initialize(user, params)
|
||||
@user, @params = user, params
|
||||
@ip_address = @params.delete(:ip_address)
|
||||
end
|
||||
|
||||
def notification_service
|
||||
|
|
Loading…
Reference in New Issue