您如何使用用户(设计存储电子邮件和密码)来属于_to Profile 和 Profile has_one User?当我查找数据库 profile_int 仍然是 nil 嗯...不知道我在哪里做错了?
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :profile_id
# attr_accessible :title, :body
belongs_to :profile
end
class Profile < ActiveRecord::Base
attr_accessible :dob, :firstName, :lastName, :school_id, :schYear, :user_attributes
belongs_to :school
has_one :user
accepts_nested_attributes_for :user
end
我知道通常我应该做类似 Profile.create(.......) 的事情,但如果我用设计来做,我不确定在哪里做