I'm trying to build a nested form that will create a new user and subscribe them to a plan.
When I hit "Enroll" I get the following error:
Validation failed: Plan subscriptions user can't be blank
I've double and triple checked everything below and am not sure what's wrong at this point. Any idea why the subscription is not being associated to the new user record?
Here's my code:
User.rb
class User < ActiveRecord::Base
  attr_accessible ..., :plan_subscriptions_attributes
  has_many :plan_subscriptions, dependent: :destroy      
  accepts_nested_attributes_for :plan_subscriptions
PlanSubscriptions.rb
class PlanSubscription < ActiveRecord::Base
  belongs_to :user
Plan_Subscriptions#new
  def new
      @plan = Plan.find(params[:plan_id])
      @user = User.new
      @user.plan_subscriptions.build
  end
Plan_Subscriptions/New.html
<%= form_for @user do |f| %>
    <fieldset>
        <%= f.text_field :first_name, :label => false, :placeholder => 'First Name', :required => false %>
        <%= f.text_field :last_name,  :label => false, :placeholder => 'Last Name', 
          <%= f.fields_for :plan_subscriptions do |builder| %>
            <%= builder.hidden_field :plan_id, :value => @plan.id %>
           <% end %>
        <%= f.submit 'Enroll', :error => false %>
    </fieldset>
<% end %>
 
    