Forum: Ruby on Rails Unexpected attribute modification

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6f94c45fd92acbb3e21c328f6b35298a?d=identicon&s=25 Bradley Mazurek (Guest)
on 2006-03-12 20:50
(Received via mailing list)
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?

Thanks,
  Brad
--
Bradley Mazurek
This topic is locked and can not be replied to.