Preparing to introduce jQuery to Ruby on Rails

Environment / Prerequisites

macOS Catalina version 10.15.4 ruby 2.5.1p57 (2018-03-29 revision 63029) Rails 5.2.4.3

jQuery introduction preparation

Check the Gemfile and

gem "jquery-rails"

It is described as.

In application.js,

//= require jquery 

It is described as. * As a caveat, write above "// = require_tree."

//= require jquery

//= require_tree .

Check if jQuery can actually be used. Create a js file with any name. (If there is a coffee file with the same name, delete it.)


$(function(){
 console.log('OK');
});

Now refresh the page and if the console says'OK', you're ready to go!

Recommended Posts

Preparing to introduce jQuery to Ruby on Rails
How to deploy jQuery on Rails
How to use Ruby on Rails
How to introduce jQuery in Rails 6
[Ruby on Rails] How to use CarrierWave
Deploy to Heroku [Ruby on Rails] Beginner
[Ruby on Rails] How to use redirect_to
[Ruby on Rails] How to use kaminari
[Ruby on Rails] Button to return to top
Introduce Vue.js to Rails
Ruby on Rails Elementary
Ruby on Rails basics
Ruby On Rails Association
Deploy to Ruby on Rails Elastic beanstalk (EB deploy)
[Ruby on Rails] How to display error messages
How to add / remove Ruby on Rails columns
[Ruby on Rails] How to install Bootstrap in Rails
[Ruby on Rails] How to use session method
[Introduction] Try to create a Ruby on Rails application
Method summary to update multiple columns [Ruby on Rails]
Ruby on rails learning record -2020.10.03
[Ruby on Rails] How to write enum in Japanese
Portfolio creation Ruby on Rails
Ruby on rails learning record -2020.10.04
Ruby on rails learning record -2020.10.09
Ruby on Rails config configuration
[Ruby on Rails] How to change the column name
[Updated from time to time] Ruby on Rails Convenient methods
[Ruby on Rails] Change URL id to column name
Ruby on Rails basic learning ①
[Ruby on Rails] about has_secure_password
Ruby on rails learning record-2020.10.07 ②
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
Commentary on partial! --Ruby on Rails
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Ruby on rails learning record -2020.10.06
[Ruby on Rails] From MySQL construction to database change
(Ruby on Rails6) How to create models and tables
Ruby on Rails validation summary
Ruby on Rails Basic Memorandum
Deploy to Ruby on Rails Elastic beanstalk (IAM permission change)
<Dot installation> Introduction to Ruby on Rails5 Source code comparison
[Ruby on Rails] Elimination of Fat Controller-First, logic to model-
From Ruby on Rails error message display to Japanese localization
How to display a graph in Ruby on Rails (LazyHighChart)
[Ruby on Rails] Column restrictions when saving to DB (4 representatives)
Apply CSS to a specific View in Ruby on Rails
Ruby on Rails Overview (Beginner Summary)
[Ruby on Rails] yarn install --check-files
Preparing to create a Rails application
Ruby on Rails variable, constant summary
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
[Ruby on Rails] Introduced paging function
Basic knowledge of Ruby on Rails
How to deploy Bootstrap on Rails
[Ruby on Rails] Add / Remove Columns
Until you introduce fonts to Rails
Ruby on Rails Japanese-English support i18n
(Ruby on Rails6) "Erase" posted content
[Ruby on Rails] CSV output function