I want to implement the current_user for backbone.
I do this via sending a request to app.com/current_user.json
The async part of fetch does not seem to work
class App.Models.CurrentUser extends Backbone.Model
url: '/current'
defaults:
"created_at":"never",
"email":"new",
"id": "0",
"updated_at":"always"
current_user:() =>
@fetch(
succes:(response,status) =>
console.log(status)
return status
)
Console log prints out exactly what I am trying to return, however the function itself returns an object with responseText as json that I want to get from this function.
Its cause it just returns the model and the server response. This is the part from the backbone source that handles the response on
fetchSo if you wanna have the model returned, just use the first parameter passed into your success method.