lib/jets/controller/rendering/rack_renderer.rb in jets-2.3.19 vs lib/jets/controller/rendering/rack_renderer.rb in jets-3.0.0
- old
+ new
@@ -61,10 +61,16 @@
rack_headers = rackify_headers(headers)
options.merge!(rack_headers)
# Note @options[:method] uses @options vs options on purpose
@options[:method] = event["httpMethod"].downcase if event["httpMethod"]
+
+ # This is how we pass parameters to actionpack. IE: params to the view.
+ # This is because renderer_options is actually the env that is passed to the rack request.
+ options.merge!("action_dispatch.request.path_parameters" => @controller.path_parameters)
+ options.merge!("action_dispatch.request.query_parameters" => @controller.query_parameters)
+ options.merge!("action_dispatch.request.request_parameters" => @controller.request_parameters)
options
end
def render_options
# normalize the template option
@@ -96,10 +102,10 @@
"#{template_namespace}/#{@controller.meth}"
end
# PostsController => "posts" is the namespace
def template_namespace
- @controller.class.to_s.sub('Controller','').underscore.pluralize
+ @controller.class.to_s.sub('Controller','').underscore
end
# Takes headers and adds HTTP_ to front of the keys because that is what rack
# does to the headers passed from a request. This seems to be the standard
# when testing with curl and inspecting the headers in a Rack app. Example: