Create deferred not being executed

For some reason, My deferred on my model’s create method seems that it’s not being executed.

My create method

"#add_feed click": function(){
  var self = this;
  var new_url        = $('#url_input').val();
  var policy_id      = $('#policy_dropdown')[0].selectedOptions[0].attributes.name.value;
  var new_feed_def   = SyndicateFeed.create({ url: new_url, policy_id: policy_id });

  new_feed_def.then(function(new_feed){
    console.log('In new_feed_def');
    var feeds_def = SyndicateFeed.findAll({});
    feeds_def.then(function(feeds){
      self.options.feeds = feeds;
      self.options.feeds.push(new_feed);
      self.on();
    })
  });
}

For some reason, the console.log() inside the .then function never gets called.

I figured out what was wrong, I am fairly new to JS development and I failed to realize that my ruby methods must return json in order for the ajax calls to work properly :\

1 Like