【发布时间】:2012-09-17 01:26:49
【问题描述】:
class User
include Mongoid::Document
has_one :profile
end
class Profile
include Mongoid::Document
belongs_to :user
end
我可以成功创建与用户关联的个人资料。但是,似乎我实际上可以创建许多与用户关联的配置文件。如何只允许为每个用户创建一个配置文件?顺便说一句,我是新手,所以请随时建议可能有帮助的其他阅读材料。
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 mongoid