그래서 레일스 -API 젬을 사용하여 레일 API를 만들었습니다. 그리고 백본 코드를 기본 public/index.html에 넣습니다. json 링크를 시도하고 json을 반환합니다.이 모델은 기본 레일 필드와 함께 'content'라는 단일 필드가있는 '항목'이라는 모델입니다. 하지만 백본 코드가 작동하지 않습니다.이 문제가 발생할 수 있습니까? 난 그냥 반환 된 json에서 레코드 목록을 표시하려고합니다.rails api를 사용한 간단한 백본 예
// Models window.Entry = Backbone.Model.extend(); window.EntryCollection = Backbone.Collection.extend({ model:Entry, url:"http://localhost:3000/entries" }); // Views window.EntryListView = Backbone.View.extend({ tagName:'ul', initialize:function() { this.model.bind("reset", this.render, this); }, render:function (eventName) { _.each(this.model.models, function (entry) { $(this.el).append("
에시 추가 변경 사항을 추가 –