Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not function with Rails 6.0.2.2 #19

Open
Vorkosigan76 opened this issue Apr 6, 2020 · 2 comments
Open

Does not function with Rails 6.0.2.2 #19

Vorkosigan76 opened this issue Apr 6, 2020 · 2 comments

Comments

@Vorkosigan76
Copy link

I tried to make this gem work with Rails 6.0.2.2 (where the javascript have moved from assets/javascript to their own javascript folder - which is why the installer does not work)... without success

What I did is:

Modify javascript/packs/application.js

//= require jquery
//= require popper
//= require bootstrap-sprockets
//= require datatables

Create javascript/packs/datatables.js

//Core component
//= require datatables/jquery.dataTables
//Bootstrap4 theme
//= require datatables/dataTables.bootstrap4

And the datatables javascript is not loaded, which leads to the following:

$(...).DataTable is not a function TypeError: $(...).DataTable is not a function

What should I do?

@mkhairi
Copy link
Owner

mkhairi commented Apr 21, 2020

@Vorkosigan76, Rails 6 has added Webpacker as the default JavaScript compiler instead of Sprockets. See readme

@mkhairi
Copy link
Owner

mkhairi commented Apr 21, 2020

if you still want to use with sprockets, you need to recreate javascripts folder in app/assets/
and update app/assets/config/manifest.js to tell sprockets load those folders.

this default sprockets manifest in previous rails version

//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

and dont forget to add this in your layout file
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants