
YAML adapter does not support Discriminator (0.10.2 release)
Reported by sfeu | January 18th, 2010 @ 06:43 AM
If you try to save an object that was instantiated by a class
definition
containing a Discriminator:
class Element
include DataMapper::Resource
property :id, Serial
property :name, String
property :classtype, Discriminator
end
The following error is returned:
TypeError: can't dump anonymous class Class
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:6:in `to_yaml'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:41:in `node_export'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:41:in `add'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:41:in `to_yaml'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:40:in `each'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:40:in `to_yaml'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:39:in `map'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:39:in `to_yaml'
from /usr/lib/ruby/1.8/yaml.rb:391:in `call'
from /usr/lib/ruby/1.8/yaml.rb:391:in `emit'
from /usr/lib/ruby/1.8/yaml.rb:391:in `quick_emit'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:38:in `to_yaml'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:110:in `node_export'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:110:in `add'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:110:in `to_yaml'
from /usr/lib/ruby/1.8/yaml/rubytypes.rb:109:in `each'
... 7 levels...
from /usr/lib/ruby/1.8/yaml.rb:117:in `dump'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/yaml_adapter.rb:90:in `write_records'
from /usr/lib/ruby/1.8/pathname.rb:798:in `open'
from /usr/lib/ruby/1.8/pathname.rb:798:in `open'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/yaml_adapter.rb:89:in `write_records'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/yaml_adapter.rb:64:in `update_records'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/adapters/yaml_adapter.rb:9:in `create'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/repository.rb:129:in `create'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/resource.rb:864:in `_create'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/resource.rb:927:in `save_self'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/resource.rb:912:in `_save'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/resource.rb:1085:in `run_once'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/resource.rb:911:in `_save'
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/resource.rb:362:in `save!'
from (irb):19
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »