title: ActiveRecord::UnknownAttributeError in Devise::RegistrationsController#create unknown attribute: user_id
body: <p>I get the error above when trying to sign up for an account.  I am using Devise and trying to add profile after a person signs up.  How do I fix this error so user can sign up and make their profile?  I also want to add an avatar to the profile along with additional fields like address, phone number, etc. Here are my files:</p>
  
  <p>application_controller.rb</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
   # Prevent CSRF attacks by raising an exception.
   # For APIs, you may want to use :null_session instead.
   protect_from_forgery with: :exception
   before_filter :configure_permitted_parameters, if: :devise_controller?
  
  protected
  
   def configure_permitted_parameters
     devise_parameter_sanitizer.for(:sign_up) &lt;&lt; :name
     devise_parameter_sanitizer.for(:account_update) &lt;&lt; :name
   end
  
    def after_sign_in_path_for(resource)
      profiles_path(resource)
    end
  
    def after_sign_up_path_for(resource)
      profiles_path(resource)
    end
  end
  </code></pre>
  
  <p>profile.rb</p>
  
  <pre><code>class Profile &lt; ActiveRecord::Base
      belongs_to :user 
  
  end
  </code></pre>
  
  <p>user.rb</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable 
  
    has_many :pins, dependent: :destroy
  
      validates :name, presence: true
  
      has_one :profile
    before_create :build_profile #creates profile at user registration
  end
  </code></pre>
  
  <p>routes.rb</p>
  
  <pre><code>'Rails.application.routes.draw do
    resources :profiles
  
    resources :pins
    devise_for :users
  
  
  
    #devise_for :installs
    root "pins#index"
    get "about" =&gt; "pages#about"
  </code></pre>
  
  <p>schema.rb</p>
  
  <pre><code>ActiveRecord::Schema.define(version: 20140818034852) do
  
    create_table "installs", force: true do |t|
      t.string   "email",                  default: "", null: false
      t.string   "encrypted_password",     default: "", null: false
      t.string   "reset_password_token"
      t.datetime "reset_password_sent_at"
      t.datetime "remember_created_at"
      t.integer  "sign_in_count",          default: 0,  null: false
      t.datetime "current_sign_in_at"
      t.datetime "last_sign_in_at"
      t.string   "current_sign_in_ip"
      t.string   "last_sign_in_ip"
      t.datetime "created_at"
      t.datetime "updated_at"
    end
  
    add_index "installs", ["email"], name: "index_installs_on_email", unique: true
    add_index "installs", ["reset_password_token"], name: "index_installs_on_reset_password_token", unique: true
  
    create_table "pins", force: true do |t|
      t.string   "description"
      t.datetime "created_at"
      t.datetime "updated_at"
      t.integer  "user_id"
      t.string   "image_file_name"
      t.string   "image_content_type"
      t.integer  "image_file_size"
      t.datetime "image_updated_at"
    end
  
    add_index "pins", ["user_id"], name: "index_pins_on_user_id"
  
    create_table "profiles", force: true do |t|
      t.datetime "created_at"
      t.datetime "updated_at"
    end
  
    create_table "user_profiles", force: true do |t|
      t.datetime "created_at"
      t.datetime "updated_at"
    end
  
    create_table "users", force: true do |t|
      t.string   "email",                  default: "", null: false
      t.string   "encrypted_password",     default: "", null: false
      t.string   "reset_password_token"
      t.datetime "reset_password_sent_at"
      t.datetime "remember_created_at"
      t.integer  "sign_in_count",          default: 0,  null: false
      t.datetime "current_sign_in_at"
      t.datetime "last_sign_in_at"
      t.string   "current_sign_in_ip"
      t.string   "last_sign_in_ip"
      t.datetime "created_at"
      t.datetime "updated_at"
      t.string   "name"
    end
  
    add_index "users", ["email"], name: "index_users_on_email", unique: true
    add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
  
  end
  </code></pre>