5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/concerns/lookbook/with_preview_controller_concern.rb', line 5
def preview_controller
@_preview_controller ||= begin
path_parameters = begin
request_path = main_app.respond_to?(:root_path) ? main_app.root_path : "/"
Rails.application.routes.recognize_path(request_path)
rescue
if main_app.respond_to?(:new_user_session_path)
Rails.application.routes.recognize_path(main_app.new_user_session_path)
end
end
preview_request = request.clone
preview_request.path_parameters = path_parameters if path_parameters.present?
controller = Engine.preview_controller.new
controller.request = preview_request
controller.response = response
controller
end
end
|