jquery-ui is a separate project from jquery. You don’t get jquery-ui by default with a new rails app. So to add it do the following.

Gemfile
gem ‘jquery-ui-rails’

application.js
//= require jquery.ui.all

https://github.com/joliss/jquery-ui-rails

<!DOCTYPE html>
<html>
<head>
  <title>Foo</title>
  <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
  <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
  <%= csrf_meta_tags %>
  <script>
      $(function() {
          $( "#datepicker" ).datepicker();
      });
  </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>

<%= yield %>

</body>
</html>