Skip to content

Remove use of $.rails to avoid silent initialization errors #61

Closed
@dcecile

Description

(Continued from twbs/bootstrap-rubygem#127...)

In integrating data-confirm-modal into my Rails app, I accidentally used this ordering in my application.js file:

//= require rails-ujs
//= require turbolinks
//= require jquery3
//= require popper
//= require bootstrap
//= require_tree .

With this ordering data-confirm-modal doesn't perform Rails initialization, because $.rails wasn't set. I resolved the issue by moving the //= require jquery3 to the top. With jQuery included first, data-confirm-modal initialized without any problems.

I had originally created this as a documentation issue for bootstrap-rubygem (which explains the application.js setup), but @glebm has suggested that this be resolved by changing data-confirm-modal to stop using $.rails.

What do you think? Would an alternative to $.rails help make the initial setup of data-confirm-modal easier?

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions