1
class User
include DataMapper::Resource
property :id, Serial
property :name, String
property :email, String
has n, :records
end
class Project
include DataMapper::Resource
property :id, Serial
property :name, String
has n, :records ?????
end
#
class Record
# SPEND_REGEX = /^[0-9]{1}:[0-5]{1}[0-9]{1}$/
include DataMapper::Resource
property :id, Serial
property :reporting_type, String
property :spend_time, String
belongs_to :user
belongs_to :project ????
end
DataMapper.auto_upgrade!
With ???我標記關係拋出一個錯誤「`execute_non_query':不能添加一個NOT NULL列與默認值NULL(DataObjects :: SyntaxError) 」 如何定義2有很多關係到一個模型在datamapper?`execute_non_query':無法添加具有默認值NULL的NOT NULL列(DataObjects :: SyntaxError)
這太棒了!謝謝!我無法獲得datamapper添加我的關係,並發現這一點。 – Hayden 2015-02-21 19:25:24