Created
February 3, 2011 20:20
-
-
Save x37v/810119 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo < ActiveRecord::Base | |
has_many :bars | |
end | |
class Bar < ActiveRecord::Base | |
belongs_to :foo, :polymorphic => true #is polymorphic even needed? | |
end | |
class Baz < Bar | |
end | |
foo = Few.new | |
foo.bars << Baz.new | |
foo.save | |
#gives me 'Bar' | |
foo.bars.each do |b| | |
puts b.class | |
end | |
#i'm finding that i need to do this | |
foo.bars.reload.each do |b| | |
puts b.class | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment