Add initializer to include helpers in all assets (including .js)

This commit is contained in:
Luka Murn 2018-04-25 10:51:19 +02:00
parent c0da83c5de
commit bd6f97fabc
2 changed files with 7 additions and 2 deletions

View file

@ -1,7 +1,5 @@
//= require jquery-ui/widgets/sortable
<% environment.context_class.instance_eval { include RepositoryDatatableHelper } %>
var RepositoryDatatable = (function(global) {
'use strict';

View file

@ -0,0 +1,7 @@
# This code will include the listed helpers in all the assets
Rails.application.config.assets.configure do |env|
env.context_class.class_eval do
# This is required for repository_datatable.js.erb
include RepositoryDatatableHelper
end
end