RubyMine
 
Get RubyMine
You are viewing the documentation for an earlier version of RubyMine.

Add a JavaScript asset to a Rails application

Last modified: 09 August 2022

Completed project: rails_helloworld, the javascript branch

In the previous tutorial, we created a simple Rails application with a view containing only static text. In this guide, we'll add a button to the web page and handle the button click on the client side using a JavaScript asset.

Before starting this tutorial, repeat steps from the previous one to create the basic Rails application. This application references the Webpacker gem used to manage JavaScript modules.