0.02
The project is in a healthy, maintained state
A tiny Fetch API wrapper that allows you to make http requests without need to handle to send the CSRF Token on every request
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Runtime

>= 6.0.0
 Project Readme

Request.JS for Rails

Rails Request.JS encapsulates the logic to send by default some headers that are required by rails applications like the X-CSRF-Token.

Installation

  1. Add the requestjs-rails gem to your Gemfile: gem 'requestjs-rails'
  2. Run ./bin/bundle install.
  3. Run ./bin/rails requestjs:install

If using the asset pipeline to manage JavaScript, the last command will:

  • Append import "@rails/request.js" to your app/assets/javascripts/application.js entrypoint.

Make sure you've already installed importmap-rails and that it's referenced before requestjs-rails in your Gemfile.

If using Webpacker to manage JavaScript, the last command will:

  • Install the Request.JS NPM package.

Usage

With the installation done check the documentation in the Rails Request.JS repository.

License

Request.JS for Rails is released under the MIT License.