My table already has a type column of char(1). Currently these types
are 'm' and 's', yes lowercase.
Since I can't modify the tables I play along and create a class:

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
end

When I save a record, the :type property's config maintains the
convention of lowercase type name.
But when I try to retrieve records DM looks for an uppercase value of
'M' in the type column.

I've looked into modifying the Query created by DM::Resource at
several points but there appears to be no minimally invasive way to do
this. Even so, I'm not familiar with the framework and code and would
be worried that I might break something with my modification(s).

Any ideas?

As a side note It would be great if I didn't have to use a class named
M or S, though  I can easily delegate to them through classes with
descriptive names if there's no solution.

I originally set this up with AR and CPK, but ran into several CPK
bugs so I had to abandon ship. DM seems promising if I can get around
this issue.

Thanks


-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to