8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/profiler/api/ajax_controller.rb', line 8
def link
parent_token = params[:parent_token]
child_token = params[:child_token]
if parent_token.blank? || child_token.blank?
return render json: { error: "Missing parent_token or child_token" }, status: :bad_request
end
child_profile = Profiler.storage.load(child_token)
unless child_profile
return render json: { error: "Child profile not found" }, status: :not_found
end
child_profile.parent_token = parent_token
child_profile.is_ajax = true
Profiler.storage.save(child_token, child_profile)
render json: { success: true }
rescue => e
render json: { error: e.message }, status: :internal_server_error
end
|