2

How can I use a non-crud action from my rails controller in Ember.js?

i.e. in my controller I have few more action except index, show, create... like a makeMoreFun action and I wanna use it in ember

Marcin Petrów
  • 1,447
  • 5
  • 24
  • 39

1 Answers1

1

You can use straight JQuery ajax calls:

$.ajax({
  url: '/projects/' + project_id + '.json',
  type: 'GET',
  success: function(data, textStatus, xhr) {
    result.setProperties(data.project);
    result.set('isLoaded', true);
  },
  error: function(xhr, textStatus, errorThrown) {
    alert('not found');
  }
Rudi
  • 1,577
  • 3
  • 16
  • 42
  • NB if you are using Ember Data you can call the adapter directly per my answer here - http://stackoverflow.com/a/23046336/1396904 – andorov Apr 13 '14 at 18:05