Use JsRoutes in .js.erb files

This commit is contained in:
Sebastian Serth
2023-12-22 00:49:32 +01:00
committed by Sebastian Serth
parent 34aac83909
commit 9147482876

View File

@ -19,13 +19,11 @@ CodeOceanEditorFlowr = {
'</div>',
getInsights: function () {
<% self.class.include Rails.application.routes.url_helpers %>
var flowrUrl = '<%= insights_path %>';
var stackOverflowUrl = 'https://api.stackexchange.com/2.2/search/advanced';
return jQuery.ajax({
dataType: "json",
url: flowrUrl,
url: Routes.insights_path(),
data: {}
}).then(function (insights) {
var stackoverflowRequests = _.map(insights, function (insight) {