找不到child_model(NameError)
|
我无法确定为什么在这里出现名称错误。我是DataMapper的新手,但尝试进行关联。任何帮助表示赞赏。
用户:
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!
没有找到相关结果
已邀请:
2 个回复
倾坞髓
。在仅定义一个模型后调用它时,那里没有子模型。相反,您应该定义和/或要求所有模型,然后执行以下操作:
才改隘瘁
然后在您的应用程序文件中需要init文件