From 685142e4f46292190cedb1d9c69953a948ea92fc Mon Sep 17 00:00:00 2001 From: brainopia Date: Thu, 15 Jan 2015 16:52:46 +0300 Subject: Support `:assigns` option when rendering with controllers/mailers. --- actionview/lib/action_view/rendering.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'actionview/lib/action_view/rendering.rb') diff --git a/actionview/lib/action_view/rendering.rb b/actionview/lib/action_view/rendering.rb index abd3b77c67..1e8e7415d1 100644 --- a/actionview/lib/action_view/rendering.rb +++ b/actionview/lib/action_view/rendering.rb @@ -92,12 +92,15 @@ module ActionView # Find and render a template based on the options given. # :api: private def _render_template(options) #:nodoc: - variant = options[:variant] + variant = options.delete(:variant) + assigns = options.delete(:assigns) + context = view_context + context.assign assigns if assigns lookup_context.rendered_format = nil if options[:formats] lookup_context.variants = variant if variant - view_renderer.render(view_context, options) + view_renderer.render(context, options) end # Assign the rendered format to lookup context. -- cgit v1.2.3