Backbone.js on Rails - Access data in Rails outside of the Backbone model -
i have backbone.js application ror backend.
the typical backbone.js setup gets data table, , updates/saves data same table. however, backbone model made of universal list of vendors, , want user able "select" vendor, dump different table, called user_selected_vendors.
i don't know how set in backbone. ideas?
its hard give specific advice without seeing code examples.
in general though, should think of rails backend providing json service endpoints backbone code talk with. when rails app receives requests backbone front end, can whatever necessary request data. not limited providing json endpoints directly map database tables.
also, based on name of user_selected_vendors
table, seems not taking advantage of activerecord associations. may want along lines of adding has_many :vendors
association user
model. see: http://guides.rubyonrails.org/association_basics.html#the-has_many-association
Comments
Post a Comment