jnunemaker/mongomapper — Issue #388: Polymorphic Associations should not try to save owner when building record
Author: bearded
Created: 2012-02-11 18:04:55+00:00
State: open

```console
Loading development environment (Rails 3.0.11)
1.9.3p0 :001 > class Article
1.9.3p0 :002?> include MongoMapper::Document
1.9.3p0 :003?> key :title, :required => true
1.9.3p0 :004?> many :comments, :as => :commentable
1.9.3p0 :005?> end
=> [Article]
1.9.3p0 :006 >
1.9.3p0 :007 > class Product
1.9.3p0 :008?> include MongoMapper::Document
1.9.3p0 :009?> key :sku
1.9.3p0 :010?> many :comments, :as => :commentable
1.9.3p0 :011?> end
=> [Product]
1.9.3p0 :012 >
1.9.3p0 :013 > class Comment
1.9.3p0 :014?> include MongoMapper::Document
1.9.3p0 :015?> key :text
1.9.3p0 :016?> belongs_to :commentable, :polymorphic => true
1.9.3p0 :017?> end
=> nil
1.9.3p0 :018 > a = Article.new
=> #

1.9.3p0 :019 > a.comments.build
=> #
1.9.3p0 :020 > a.errors
=> {:title=>["can't be blank"]}
```