Angular $ being seen as GET request to remote rails server

Hi All - I’m currently working on an app which uses a JSON post request to a remote server once the device is registered for push notifications. Since it involves push notifications, and potential CORS issues, I have to use xcode and my phone for testing for this, unfortunately :frowning:

Anyway, I’m having issues with angular $ to create a “user” with JSON data. I’m posting to a remote heroku rails server, which is being returned with a 404 status. But, the server logs claims it’s coming in as a GET request, and thus recognizing it as a request for index.

Here’s my current angular code which results in the 404 (I also tried the $ with the same result):

var user = { "user": { token: $scope.regId } };
var req = {
 method: 'POST',
 url: '',
 dataType: "json",
 headers: {
   'Content-Type': 'application/json'
 data: user,

And here is my rake routes result on the server:

users GET    /users(.:format)            users#index
          POST   /users(.:format)        users#create

And here is the result in the server log:

2015-01-03T03:10:02.586430+00:00 app[web.1]: Started GET "/users.json" for at 2015-01-03 03:10:02 +0000
2015-01-03T03:10:02.590083+00:00 app[web.1]:
2015-01-03T03:10:02.590086+00:00 app[web.1]: AbstractController::ActionNotFound (The action 'index' could not be found for UsersController):

Does anyone have an idea why this request ends up sent as a get? Or if the JSON isn’t being sent at all?

And/or any debugging tips through the xcode console would be greatly appreciated, I’m not doing so well without my usual chrome tools :frowning:


Just in case anyone else has this problem - I finally backed up and got CORS working, but it turns out for heroku when you’re doing something other than GET you need to go to (not just It’s possible that it started working from getting CORS working, but if anyone’s trying to just get it working direct from the device, I’d try using herokuapps first.