(I sent this yesterday but did not see it on the list. Maybe it wasn't 
approved..?)

I have a legacy DB which cannot be modified. There is already a column named 
type, it's a char(1) and contains lowercase chars, 'm' or 's'. 

class M < Spot 
  include DataMapper::Resource

  property :type, Discriminator, :field => 'Type', :key => true, :writer => 
:private, :default => 'm'
  property :identifier, String, :length => 32, :field => 'Identifier', :key => 
true

 #relationships...
end

Spot is not a DataMapper resource. 

Based on the :type property's config I can write records with a lowercase 'm' 
but, since the class' name is uppercase, when I retrieve records DataMapper 
looks for a type column with an uppercase 'M'.

I've been looking at the source trying to find a minimally invasive way to fix 
this yet there seems to be none. Overriding conditions or query in Resource 
looks OK but I'm concerned this could break how associations (omitted from 
above example) are retrieved, or something else. 

Any good ways around this?

Thanks




      

-- 
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