Backbone only fills in first model from collection when I fetch.
@leadgen_forms = new app.collections.LeadgenForms [],
{ event_provider_id: @event_provider_id }
@leadgen_forms.fetch
success: _.bind ((collection, response) ->
debugger
When I inspect collection from success:
The image above shows a length of 11 but only a single model. I know that if each model doesn't have a unique id, then backbone treats the models as duplicates. However, when i inspect the data returned from the JSON service, all all ids are unique and everything else looks kosher:
From the model:
window.app.models.LeadgenForm = Backbone.Model.extend
initialize: (model, options) ->
@event_provider_id = options.event_provider_id
@id = options.id
url: ->
if @id
'/event_providers/' + @event_provider_id + '/leadgen_forms/' + @id
else
'/event_providers/' + @event_provider_id + '/leadgen_forms'
window.app.collections.LeadgenForms = Backbone.Collection.extend
model: window.app.models.LeadgenForm
initialize: (collection, options) ->
@event_provider_id = options.event_provider_id
parse: (response) ->
debugger
return response
url: ->
'/event_providers/' + @event_provider_id + '/leadgen_forms'
parse
method you may have on the collection or its associated model? Also, what is the model'sidAttribute
? – Platinum Azure