How does one run a function from application.js
inside a .js.erb
file? I'd rather not have to duplicate said function.
app/assets/javascripts/application.js
$(document).on('pagecontainershow', function() {
var someFunction = function() {
function someOtherFunction() {
console.log('Hello world')
}
}();
});
app/views/articles/create.js.erb
<% unless @article.errors.any? %>
someFunction.someOtherFunction();
<% end %>