7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/adva/controller/internal_redirect.rb', line 7
def internal_redirect_to(target, params = nil)
action, controller = target.split('#').reverse
controller ||= controller_path
params ||= self.params
params.merge!(:controller => controller, :action => action)
params = yield(params) if block_given?
rack_endpoint = "#{controller}_controller".classify.constantize.action(action)
Rails.logger.debug { "redirecting internally to #{controller}##{action}" }
env['action_dispatch.request.parameters'] = params
response = rack_endpoint.call(env)
self.status, self., self.response_body = response
@_response..replace(response[1])
response
end
|