this seems to be related to storing symbols via an enum in the DB

class Profile
  include DataMapper::Resource
  property :gender, Enum.new(:male, :female, nil)


====== on 095

irb(main):024:0> p1=Profile.first
=> #<Profile id=6 user_id=3 birthday=Wed, 31 Aug 1983 gender=:male
married=false location_id=4 occupation_id=4 created_at=Sun, 31 Aug
2008 19:37:45 +0000 age_published=true married_published=true
gender_published=true location_published=true
occupation_published=true>
irb(main):025:0> p1.gender
=> :male


====== on 096

irb(main):020:0> Profile.first
TypeError: can't dup Symbol
        from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.6/lib/extlib/
object.rb:136:in `dup'
        from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.6/lib/extlib/
object.rb:136:in `try_dup'
        from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/
property.rb:397:in `set_original_value'
        from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/
property.rb:379:in `get'
        from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/
resource.rb:102:in `attribute_get'
        from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/
model.rb:397:in `gender'
        from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/
resource.rb:200:in `send'


which tracks down here:


        gems/extlib-0.9.6/lib/extlib/object.rb in `try_dup'      136

131
132 # Override this in a child if it cannot be dup'ed
133 #
134 # @return <Object>
135 def try_dup
136 self.dup
137 end
138
139 # @param arrayish<#include?> Container to check, to see if it
includes the object.
140 # @param *more<Array>:: additional args, will be flattened into
arrayish
141 #

        gems/dm-core-0.9.6/lib/dm-core/property.rb in `set_original_value'
397

392 resource.instance_variable_get(instance_variable_name)
393 end
394
395 def set_original_value(resource, val)
396 unless resource.original_values.key?(name)
397 val = val.try_dup
398 val = val.hash if track == :hash
399 resource.original_values[name] = val
400 end
401 end
402

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to