On 01/21/2010 04:55 PM, samullen wrote:
I'm dealing with two databases, both of which have tables with the
same names (e.g. both database have features, feature_items, users
tables). To distinguish between the two databases, I have wrapped the
resources in modules so I can call Content::Feature.first or
Comic::Feature.first. What DataMapper is doing, however, is prefixing
the module name to the resource name (e.g. content_features and
comic_features).
I can get around this issue by defining the table's name in the
storage_names hash/structure storage_names[:default] =
"feature_traits", but this doesn't "feel" like the right way of doing
it (especially since I will be using multiple data stores).
Any help with this would be greatly appreciated.
I've done something similar. I used the following code to tell DM to
not prepend the module to the table name:
adapter = DataMapper.setup(:default, "sqlite3:#{db}")
adapter.resource_naming_convention =
DataMapper::NamingConventions::Resource::UnderscoredAndPluralizedWithoutModule
This is with DM 0.9.11.
Earle
--
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.