-
Notifications
You must be signed in to change notification settings - Fork 254
Description
Hi there, I am using MongoDB with Mongoid, where Mongoid uses the field _id instead of id.
So if I did the example provided in the readme of rails-backbone in the index.html.erb
$(function() {
window.controller = new Blog.Controllers.PostsController({posts: <%= @posts.to_json.html_safe -%>});
Backbone.history.start();
});
I'd get "id is not defined" in the Chrome console
if I changed the above to
$(function() {
window.controller = new Kiosk.Controllers.PostsController({posts: <%= @posts.to_json.gsub('_id','id').html_safe -%>});
Backbone.history.start();
});
the difference is the gsub(), it'll display okay, and works as it should until some part of the app re-request the model directly from server where no gsub('_id', 'id') was manually done, e.g., creating a new record.
I know this can be argued that it's a mongoid thing or mongodb thing in general and not this gem's business, but is there any chance that you can allow for a customizable key what is traditionally the "id".