2014-02-07 142 views
0

。以下是我的用戶和配置文件模型,任何解決方案?協會工作不

Profile.rb

class Profile < ActiveRecord::Base 
    belongs_to :user 
end 

user.rb

class User < ActiveRecord::Base 
    has_one :profile 

    #callback that creates a profile for each user that signs up 
    after_create :create_profile 
    devise :database_authenticatable, :registerable, 
    :recoverable, :rememberable, :trackable, :validatable 

    private 
    def create_profile 
    self.profile = Profile.create 
    end 
    end 

回答