title: Argument Error First argument in form cannot contain nil or be empty
body: <p>I am setting up a form so users can add a new Stripe credit card. I receive a <code>First argument in form cannot contain nil or be empty</code> on the form to <code>&lt;%= form_for @subscription do |f| %&gt;</code></p>
  
  <p>What exactly am I missing so I can have the form up and submitting to Stripe?</p>
  
  <p>Subscription Controller:</p>
  
  <pre><code>  def new
      plan = Plan.find(params[:plan_id])
      @subscription = plan.subscriptions.build
      if params[:PayerID]
        @subscription.paypal_customer_token = params[:PayerID]
        @subscription.paypal_payment_token = params[:token]
        @subscription.email = @subscription.paypal.checkout_details.email
      end
    end
  
    def create
      @subscription = Subscription.new(params[:subscription])
      if @subscription.save_with_payment
        redirect_to @subscription, :notice =&gt; "Thank you for subscribing!"
      else
        render :new
      end
    end
  
    def show
      @subscription = Subscription.find(params[:id])
    end
  
    def paypal_checkout
      plan = Plan.find(params[:plan_id])
      subscription = plan.subscriptions.build
      redirect_to subscription.paypal.checkout_url(
        return_url: new_subscription_url(:plan_id =&gt; plan.id),
        cancel_url: root_url
      )
    end
  
      def updatesubscription
        @user = current_user
        @customer = Stripe::Customer.retrieve(@user.subscription.stripe_customer_token)
        @customer.update_subscription(:plan =&gt; "1", :prorate =&gt; true)
       current_user.save!
        flash.alert = 'Your subscription has been updated!'
        redirect_to root_url
       end
  
       def cancelsubscription
         @user = current_user
           @customer = Stripe::Customer.retrieve(@user.subscription.stripe_customer_token)
           @customer.cancel_subscription()
           current_user.save!
           flash.alert = 'Your subscription has been cancelled successfully!'
           redirect_to root_url
         end
  
         def create_card_stripe
             @user = current_user
             @customer = Stripe::Customer.retrieve(@user.subscription.stripe_customer_token)
  
             @customer.cards.create({
               :card =&gt; @user.subscription.stripe_customer_token
             })
  
             @user.update_attribute(:stripe_card_id, customer.active_card.id)
             if customer.save
               flash.alert = "Credit card updated successfully!"
               redirect_to root_url
             else
               flash.alert = "Error with updating card"
               redirect_to root_url
             end
           end
  end
  </code></pre>
  
  <p>Form:</p>
  
  <pre><code>Add new Credit Card
  &lt;%= form_for @subscription do |f| %&gt;
    &lt;% if @subscription.errors.any? %&gt;
      &lt;div class="error_messages"&gt;
        &lt;h2&gt;&lt;%= pluralize(@subscription.errors.count, "error") %&gt; prohibited this subscription from being saved:&lt;/h2&gt;
        &lt;ul&gt;
        &lt;% @subscription.errors.full_messages.each do |msg| %&gt;
          &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;
        &lt;% end %&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  
    &lt;%= f.hidden_field :plan_id %&gt;
    &lt;%= f.hidden_field :stripe_card_token %&gt;
  
    &lt;div class="field"&gt;
      &lt;%= radio_button_tag :pay_with, :card, true %&gt;
      &lt;%= label_tag :pay_with_card do %&gt;
        &lt;%= image_tag "visa.png" %&gt;
        &lt;%= image_tag "mastercard.png" %&gt;
        &lt;%= image_tag "discover.png" %&gt;
        &lt;%= image_tag "american_express.png" %&gt;
        &lt;%= image_tag "jcb.png" %&gt;
    &lt;/div&gt;
    &lt;% end %&gt;
  
    &lt;div id="billing_fields"&gt;
      &lt;div class="field"&gt;
        &lt;%= f.hidden_field :user_id, :value =&gt; current_user.id %&gt; 
        &lt;%= f.label :email %&gt;
        &lt;%= f.text_field :email %&gt;
      &lt;/div&gt;
      &lt;% if @subscription.payment_provided? %&gt;
        Payment has been provided. Click "Subscribe" to complete the subscription.
      &lt;% else %&gt;
        &lt;div class="field"&gt;
          &lt;%= label_tag :card_number, "Credit Card Number" %&gt;
          &lt;%= text_field_tag :card_number, nil, name: nil %&gt;
        &lt;/div&gt;
        &lt;div class="field"&gt;
          &lt;%= label_tag :card_code, "Security Code on Card (CVV)" %&gt;
          &lt;%= text_field_tag :card_code, nil, name: nil %&gt;
        &lt;/div&gt;
        &lt;div class="field"&gt;
          &lt;%= label_tag :card_month, "Card Expiration" %&gt;
          &lt;%= select_month nil, {add_month_numbers: true}, {name: nil, id: "card_month"} %&gt;
          &lt;%= select_year nil, {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, id: "card_year"} %&gt;
        &lt;/div&gt;
      &lt;% end %&gt;
      &lt;div id="stripe_error"&gt;
        &lt;noscript&gt;JavaScript is not enabled and is required for this form. First enable it in your web browser settings.&lt;/noscript&gt;
      &lt;/div&gt;
      &lt;div class="actions"&gt;
        &lt;%= f.submit "New Card" %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>