If I try the following:
render_to_string( :widget => Views::Posts::MyPost, :assigns => { :foo => "bar"})
foo is never getting set within the widget. It also doesn't work if I try this:
render_to_string( :widget => Views::Posts::MyPost, :foo => "bar")
In looking at the Erector code in rails/extensions/action_controller.rb, it looks like the @assigns on line 20 is never getting set:
def render_with_erector_widget(*options, &block)
if options.first.is_a?(Hash) && widget = options.first.delete(:widget)
render_widget widget, @assigns, &block
else
render_without_erector_widget *options, &block
end
end
If I replace the above @assigns with options.first[:assigns] then the first example above works. So, I'm either missing something in my render_to_text usage, or there's an error in the code.