polymorphic -able dup?

0 views
Skip to first unread message

Jason Boxman

unread,
Jul 2, 2008, 3:37:33 PM7/2/08
to orug-di...@googlegroups.com
I was rather caught off guard by this.

class Company < ActiveRecord::Base
has_many :addresses, :as => :addressable, :attributes => true
end
class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true

def foo
meh = addressable.name
meh << 'other string'
meh == addressable.name # true
end
end

Took me a minute to figure out what was going on, but apparently I have to
#dup addressable.name, otherwise I am modifying it. Produces odd results
when looping through a collection of addresses.

Is this normal behavior? Maybe it's because of attribute_fu plugin.

Reply all
Reply to author
Forward
0 new messages