User
```Name:
Email: c@c.com
```Closed charlyebrown closed 10 years ago
This is the responsetext in the object:
"<!DOCTYPE html>
Name:
Email: c@c.com
```"
The controller was not routing to the users#index but to users#show so I had to render json: {@user, @user.events} there instead!
I am unable to fetch data into my new user through Backbone. I'm not sure exactly what's happening but I am not able to populate a user from my database so I'm assuming the data is not being transferred as JSON.
My users controller index: def index @users = User.all render json: @users end
My userModel: App.UserModel = Backbone.Model.extend({ urlRoot: '/users', initialize: function(){ console.log('New User Model Created'); } })
My console: User View Generated userView.js?body=1:5 Events Collection Created eventCollection.js?body=1:7 New Router created calendarRouter.js?body=1:9 New User Model Created userModel.js?body=1:4 fired index! calendarRouter.js?body=1:13 var user = new App.UserModel({id: 1}); New User Model Created userModel.js?body=1:4 undefined user.fetch(); Object {readyState: 1, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…} user.attributes Object {id: 1}