Use JsRoutes in .js.erb files
This commit is contained in:

committed by
Sebastian Serth

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