title: Stripe.js is not loading
body: <p>I'm not sure what's going on, but it doesn't look like <code>stripe.js</code> is loading within my RoR application.  I'm attempting to load it on a per-view basis (since I don't want JS bloat on other pages).  I have moved it to the main layout page (application.js) however that didn't make a difference.</p>
  
  <blockquote>
    <p>views/packages/new.html.erb</p>
  </blockquote>
  
  <pre><code>&lt;div class="container"&gt;
    &lt;h1&gt;
      &lt;a class="login-logo" href="#"&gt;
        &lt;%= image_tag "neo-logo.svg", alt: "Kernel-Ops - Network Ops Logo" %&gt;
      &lt;/a&gt;
    &lt;/h1&gt;
  
    &lt;br/&gt;
  
    &lt;div class="row login-container column-seperation"&gt;
      &lt;div class="col-md-6 col-md-offset-3"&gt;
        &lt;h2 class="text-center"&gt;You're almost done!  We just need to collect your payment information.&lt;/h2&gt;
        &lt;br/&gt;
        &lt;br/&gt;
          &lt;div class="row"&gt;
            &lt;div align="center" class="col-md-12"&gt;
              &lt;%= render 'form' %&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <blockquote>
    <p>views/packages/_form.html.erb</p>
  </blockquote>
  
  <pre><code>&lt;%= form_tag packages_path, id: "payment_form" do %&gt;
    &lt;%= hidden_field_tag 'package_id', @package.id %&gt;
    &lt;%= hidden_field_tag 'email', current_user.email %&gt;
    &lt;%= javascript_include_tag "https://js.stripe.com/v2/" %&gt;
    &lt;script type="text/javascript"&gt; Stripe.setPublishableKey("&lt;%= Rails.configuration.stripe[:publishable_key] %&gt;")&lt;/script&gt;
  
    &lt;div class="form-group text-left"&gt;
      &lt;%= label_tag "Card Number", nil, required: true, class: "control-label" %&gt;
      &lt;%= text_field_tag :card_number, nil, class: "form-control", "data-stripe" =&gt; "number" %&gt;
    &lt;/div&gt;
  
    &lt;div class="form-group text-left"&gt;
      &lt;%= label_tag "Card Verification (CVV)", nil, required: true, class: "control-label" %&gt;
      &lt;%= text_field_tag :card_verification, nil, class: "form-control", "data-stripe" =&gt; "cvv" %&gt;
    &lt;/div&gt;
  
    &lt;div class="form-group text-left"&gt;
      &lt;%= label_tag "Card Expiration", nil, required: true, class: "control-label" %&gt;
      &lt;div class="row"&gt;
        &lt;div class="col-md-6"&gt;
          &lt;%= select_tag :exp_month, options_for_select(Date::MONTHNAMES.compact.each_with_index.map { |name,i| ["#{i+1} - #{name}", i+1] }), include_blank: false, "data-stripe" =&gt; "exp-month", class: "form-control" %&gt;
        &lt;/div&gt;
        &lt;div class="col-md-6"&gt;
          &lt;%= select_tag :exp_year, options_for_select((Date.today.year..(Date.today.year+10)).to_a), include_blank: false, "data-stripe" =&gt; "exp-year", class: "form-control" %&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;br/&gt;&lt;br/&gt;
  
    &lt;%= submit_tag "Submit Payment", class: "btn btn-success pull-right" %&gt;
    &lt;%= link_to "Cancel", :back, { :class =&gt; "btn btn-danger pull-right", :style =&gt; "margin-right: 15px;" } %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I'm looking in the Chrome debugger under the network tab and there is no reference to <code>Stripe</code>.  Since there are quite a few JS scripts already being loaded, I've also used the script search feature to confirm it's not there.</p>
  
  <p>Where is it?!</p>
  
  <p>In the end, if I attempt to submit my form I get an error:</p>
  
  <p><code>This customer has no attached payment source</code></p>
  
  <p>Which makes sense since <code>Stripe.js</code> can't do it's thing.</p>
  
  <p><strong>Quick Update</strong></p>
  
  <p>Moved the inline call to the bottom of my layout instead of within the form, now I get:</p>
  
  <p><code>Uncaught ReferenceError: Stripe is not defined</code> in the console window.  Interestingly, this is what my developer window shows me which indicated that Stripe.js loaded, but it still is acting like it didn't:</p>
  
  <p><a href="https://i.stack.imgur.com/fzTqB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fzTqB.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/6M4CL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6M4CL.png" alt="enter image description here"></a></p>