현재 데이터 액세스를 위해 DataMapper를 사용하여 기존 데이터베이스를 기반으로하는 새 앱을 만들고 있습니다. 그러나, 외래 키를 다룰 때의 규약은 데이터베이스가 사용하는 규약이 아닙니다.DataMapper 연결의 외래 키 이름
예 :
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
차라리 'invoice_id'가 아닌 'invoiceId'로 DataMapper에 사용되는 외부 키를 얻을 수있는 방법 주석으로 표시된 바와 같이이 (순간에 사용하려고 있는가 위)? 나는 이것이 일반적인 필드에서 :field => 'fieldName'
을 추가하여 수행 할 수 있다는 것을 알고 있지만 연관성을위한 그런 방법을 찾지 못했습니다.