我無法確定爲什麼在這裏出現名稱錯誤。我是DataMapper的新手,但試圖關聯。任何幫助表示讚賞。找不到child_model(NameError)
用戶:
class User
include DataMapper::Resource
property :id, Serial, :key => true
property :first_name, String
property :last_name, String
property :company, String
property :city, String
property :country, String
property :mobile_number, Integer
property :email_address, String
property :shahash, String
property :isRegistered, Boolean
belongs_to :event, :required => true
end
DataMapper.auto_upgrade!
事件:
class Event
include DataMapper::Resource
property :id, Serial, :key => true
property :name, String
property :occuring, DateTime
has n, :user
end
DataMapper.auto_upgrade!
你應該使用'has n,:users',複數形式。 – ujifgc 2011-06-15 07:10:19
使用'has n,:users'和'belongs_to:event'時仍然存在問題 我錯過了其他東西? – al3xnull 2011-06-15 13:06:40