Commit d0546e6d authored by James Lopez's avatar James Lopez

uypdated keys controller logic

parent 72b7b10d
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment