title: "Uncaught TypeError: $(...).popover is not a function" RoR - Bootstrap - jQuery
body: <p>I've checked out this <a href="https://stackoverflow.com/questions/29910823/popover-is-not-a-function">question on SO</a> because I have a similar problem with rails.
  I'm trying to make an AJAX request work (looking up some financial tickers) and I think that I'm ok with my code (at least I hope) but I'm still getting this weird error: </p>
  
  <blockquote>
    <p>bootstrap.self-fdc98dee79ee88255e10cac6caa91338165cb76cf0d263744d8d90011fc2ef8f.js:3 Uncaught TypeError: $(...).popover is not a function
        at HTMLDocument. (bootstrap.self-fdc98dee79ee88255e10cac6caa91338165cb76cf0d263744d8d90011fc2ef8f.js:3)
        at fire (jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js:3233)
        at Object.fireWith [as resolveWith] (jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js:3363)
        at Function.ready (jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js:3583)
        at HTMLDocument.completed (jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js:3618)</p>
  </blockquote>
  
  <p>Here's my script: </p>
  
  <pre><code>var init_stock_lookup;
  
  init_stock_lookup = function() {
    $('#stock-lookup-form').on('ajax:success', function(event, data, status) {
      $('#stock-lookup').replaceWith(data);
      init_stock_lookup();
    })
  }
  
  $(document).ready(function() {
    init_stock_lookup();
  })
  </code></pre>
  
  <p>Here's the page: </p>
  
  <pre><code>&lt;div id="stock-lookup"&gt;
    &lt;h3&gt;Search for stocks&lt;/h3&gt;
    &lt;%= form_tag search_stocks_path, remote: true, method: :get, id: 'stock-lookup-form' do %&gt;
      &lt;div class="form-group row no-padding text-center col-md-12"&gt;
        &lt;div class="col-md-10"&gt;
          &lt;%= text_field_tag :stock, params[:stock], placeholder: "Stock ticker symbol", autofocus: true, class: 'form-control search-box input-lg' %&gt;
        &lt;/div&gt;
        &lt;div class="col-md-2"&gt;
          &lt;%= button_tag(type: :submit, class: "btn btn-lg btn-success") do %&gt;
            &lt;i class="glyphicon glyphicon-search"&gt;&lt;/i&gt; Look up a stock
          &lt;% end %&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
    &lt;% if @stock %&gt;
      &lt;div id='stock-lookup-results' class="well results-block"&gt;
        &lt;strong&gt;Symbol:&lt;/strong&gt; &lt;%= @stock.ticker %&gt;
        &lt;strong&gt;Name:&lt;/strong&gt; &lt;%= @stock.name %&gt;
        &lt;strong&gt;Price:&lt;/strong&gt; &lt;%= @stock.price %&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p>The gem file:</p>
  
  <pre><code>source 'https://rubygems.org'
  
  git_source(:github) do |repo_name|
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
    "https://github.com/#{repo_name}.git"
  end
  
  
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  gem 'rails', '~&gt; 5.1.1'
  gem 'devise'
  gem 'twitter-bootstrap-rails'
  gem 'devise-bootstrap-views'
  gem 'sprockets-rails', :require =&gt; 'sprockets/railtie'
  gem 'jquery-rails'
  gem 'jquery-turbolinks', '~&gt; 2.1'
  gem 'stock_quote'
  # Use Puma as the app server
  gem 'puma', '~&gt; 3.7'
  # Use SCSS for stylesheets
  gem 'sass-rails', '~&gt; 5.0'
  # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '&gt;= 1.3.0'
  # See https://github.com/rails/execjs#readme for more supported runtimes
  # gem 'therubyracer', platforms: :ruby
  
  # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~&gt; 4.2'
  # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
  gem 'turbolinks', '~&gt; 5'
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  gem 'jbuilder', '~&gt; 2.5'
  # Use Redis adapter to run Action Cable in production
  # gem 'redis', '~&gt; 3.0'
  # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~&gt; 3.1.7'
  
  # Use Capistrano for deployment
  # gem 'capistrano-rails', group: :development
  
  group :development, :test do
    gem 'sqlite3'
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console
    gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
    # Adds support for Capybara system testing and selenium driver
    gem 'capybara', '~&gt; 2.13'
    gem 'selenium-webdriver'
  end
  
  group :development do
    # Access an IRB console on exception pages or by using &lt;%= console %&gt; anywhere in the code.
    gem 'web-console', '&gt;= 3.3.0'
    gem 'listen', '&gt;= 3.0.5', '&lt; 3.2'
    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
    gem 'spring'
    gem 'spring-watcher-listen', '~&gt; 2.0.0'
  end
  
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
  
  group :production do
    gem 'pg'
    gem 'rails_12factor'
  end
  </code></pre>
  
  <p>and the link to my gitHub repo : <a href="https://github.com/Ardzii/finance-tracker" rel="nofollow noreferrer">https://github.com/Ardzii/finance-tracker</a></p>
  
  <p>I'm using RoR and Bootstrap (twitter).
  What I understand from the SO link I provided earlier is that I'm having jQuery conflicts but I have no idea where and, most of all, how to fix it...</p>
  
  <p>Thanks as usual for your help guys! </p>
  
  <p>------ EDIT . -----------
  Here's my application.js for references (I added the //require twitter/bootstrap line thanks the Hieu's answer).</p>
  
  <pre><code>// This is a manifest file that'll be compiled into application.js, which will include all the files
  // listed below.
  //
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
  // vendor/assets/javascripts directory can be referenced here using a relative path.
  //
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
  // compiled file. JavaScript code in this file should be added after the last require_* statement.
  //
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
  // about supported directives.
  //
  //= require rails-ujs
  //= require twitter/bootstrap
  //= require jquery
  //= require jquery_ujs
  //= require turbolinks
  //= require_tree .
  </code></pre>