title: How to disable coffeescript for Stripe if no charge in Rails 3 app?
body: <p>I'm using Stripe to accept payments in my Rails 3 app. Stripe requires this coffeescript:</p>
  
  <pre><code>jQuery -&gt;
    Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content'))
    video.setupForm()
  
  video =
    setupForm: -&gt;
      $('#new_video input:submit').click -&gt;
        $(this).addClass('wasclicked')
  
      $('#new_video').submit -&gt;
        clickedBtn = $(this).find('.wasclicked')
  
        if clickedBtn.attr('name') != 'back_button' &amp;&amp; $('#card_number').length
          video.processCard()
          clickedBtn.removeClass('wasclicked')
          false
        else
          true
  
    processCard: -&gt;
      card =
        number: $('#card_number').val()
        cvc: $('#card_code').val()
        expMonth: $('#card_month').val()
        expYear: $('#card_year').val()
      Stripe.createToken(card, video.handleStripeResponse)
  
    handleStripeResponse: (status, response) -&gt;
      if status == 200
        $('#video_stripe_card_token').val(response.id)
        $('#new_video')[0].submit()
      else
        $('#stripe_error').text(response.error.message)
        $('input[type=submit]').attr('disabled', false)
  </code></pre>
  
  <p>In my app, if the charge to the customer is 0, then the Stripe credit card fields are hidden, and not required to successfully submit the form. This statement in my controller accounts for that:</p>
  
  <pre><code>@video.save if @video.all_valid? &amp;&amp; ((@total &gt; 0 &amp;&amp; @video.save_with_payment(@total)) || @total == 0)
  </code></pre>
  
  <p>Here's the problem I'm having: when the charge is 0, and payment is not required in my form, I hit the submit button to submit the form, and nothing happens. I can just click and click and there's no response whatsoever. However, when I reload the page, then the form is successfully submitted.</p>
  
  <p>I deleted the coffeescript file (above) for Stripe, and then the submit button worked in this instance. So how do I disable the coffeescript in this example? Would an "if" statement go into my controller, or the coffeescript?</p>