I'm currently working on a new app based around an existing database, making use of DataMapper for the data access. However, its conventions when dealing with foreign keys are not what the database uses.
Example:
class Invoice
include DataMapper::Resource
storage_names[:default] = 'invoices'
property :id, Serial
# ... more properties ...
has n, :items
end
class Item
include DataMapper::Resource
storage_names[:default] = 'invoiceItems'
property :id, Serial
# ... more properties ...
belongs_to :invoice # this should use 'invoiceId' instead of 'invoice_id'
end
Is there any way I can get the foreign key used by DataMapper to be 'invoiceId' rather than the 'invoice_id' it tries to use at the moment (as indicated by the comment above)? I know this can be done with normal fields by adding :field => 'fieldName'
but I have found no such way for associations.