Unexpected attribute modification


Hi all,

I’m trying to do multiple render_to_string() calls in a method call,
and I’m getting attributes being modified in unexpected ways.

@left_sidebar = render_to_string( :partial … )
puts @left_sidebar.id (-> 123456)
@right_sidebar = render_to_string( :partial …)
puts @left_sidebar.id (-> 234567 WTF!?!?!)
puts @right_sidebar.id (-> 345678)

How is @left_sidebar being modified by @right_sidebar= ?

If I do this:

left = render_to_string(…)
right = render_to_string(…)
@left_sidebar = left
@right_sidebar = right

I seem to be okay.

What am I missing and/or not understanding?


Bradley M.