title: undefined method `build' for nil:NilClass rails
body: <p>What I think is going on is that the :pledge attributes (:amount and :frequency)from my view is not getting passed to the new action in the controller. Also, I know that my pledge attributes are not saving and maybe that's because pledge_id is nil when calling @user.</p>
  
  <h3>new.html.erb</h3>
  
  <pre><code>&lt;%= form_for @user, url: pledge_path, controller: 'user', action:     'create', method: 'post' do |f| %&gt;
    &lt;%= f.label :user_name %&gt;
    &lt;%= f.text_area :user_name %&gt;
    &lt;%= f.label :email %&gt;
    &lt;%= f.text_area :email%&gt;
    &lt;%= f.label :address %&gt;
    &lt;%= f.text_area :address %&gt;
    &lt;%= f.fields_for(:pledge) do |b| %&gt;
      &lt;%= b.label :amount %&gt;
      &lt;%= b.text_area :amount %&gt;
      &lt;%= b.label :frequency %&gt;
      &lt;%= b.text_area :frequency %&gt;
      &lt;%= b.submit 'I also want o pledge' %&gt;
    &lt;% end %&gt;
  &lt;%= f.submit 'I just want to sumbit my info' %&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <h3>pledge.rb</h3>
  
  <pre><code>class Pledge &lt; ActiveRecord::Base
    belongs_to :user
    validates_presence_of :user
  
  end
  </code></pre>
  
  <h3>user.rb</h3>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :pledges, foreign_key: "pledge_id"
     accepts_nested_attributes_for :pledges
     attr_accessor :pledges
  
  end
  </code></pre>
  
  <h3>schema.rb</h3>
  
  <pre><code>ActiveRecord::Schema.define(version: 20150318161827) do
  
  create_table "pledges", force: :cascade do |t|
    t.integer "frequency"
    t.float   "amount"
    t.integer "user_id"
  end
  
  add_index "pledges", ["user_id"], name: "index_pledges_on_user_id"
  
  create_table "users", force: :cascade do |t|
    t.string  "user_name"
    t.string  "email"
    t.string  "address"
    t.integer "pledge_id"
  end
  
  end
  </code></pre>
  
  <h3>user_controller.rb</h3>
  
  <pre><code>class UserController &lt; ApplicationController
  def new
      @user = User.new
      @user.pledges.build 
  end
  
  def create
      if params[:commit] == 'I just want to sumbit my info'
          User.create(user_params)
  
      elsif
          @pledge = Pledge.new(params[:pledge])
          @pledge.save
          @user = User.create(pledge_params)  
      end
      redirect_to thank_you_path
  
  end
  def pledge_params
      params.require(:user).permit(:email, :user_name, :address,
                                  pledge_attributes: [:id, :amount, :frequency])
  end
  
  def user_params
      params.require(:user).permit(:email, :user_name, :address)
  end
  end
  </code></pre>
  
  <p>Thanks in advance for any suggestions!</p>