Closed mugwump closed 13 years ago
The magic is happening from <backbone_rails gem path>/vendor/assets/javascripts/backbone_datalink.js
. It looks like it extends jQuery with the backboneLink method--so using jQuery to select that DOM object should make it available.
ok, got it: I had to include the datalink manually
#= require backbone_datalink
#= require backbone_rails_sync
now this automatic binding works.
Maybe it would be nicer to include something like https://github.com/derickbailey/backbone.modelbinding as it is more flexible than the provided datalink?!
That sounds like a good idea. The documentation on that looks really solid.
That may have to be a feature you or someone else rolls out, though. I notice codebrew isn't participating in issues for this project.
ok, I can try that. I'll start with incorporating this manually first: I've already done lots of tweaks to the generated code, that then need to be refactored back into the generators.
I've already incorporated https://github.com/PaulUithol/Backbone-relational, the above modelbinding and so on - do you have any idea how to deal with these external .js?! They are usually not packaged as a gem, but simply copying&freezing them also does not look right (But that also holds true for the underscore and backbone-libs...)
An idea would be forking&packaging them into a gem - but that also looks like a lot of work...
I think external js libraries are packaged as gems to make it easy for devs to maintain current versions. If it's too much work for you right now, copying and freezing them would be simpler--even if it does make it harder to have an up-to-date version. Better to put together something you can use and seeing if it catches on, rather than spending a lot of time perfecting it first.
Just generated a scaffold and walking through the generated code: Most things work fine but there is problem with the edit_view.js:
which gives a:
As I understand it, the call shall link the edit-form to the update-method of the view (?!) - but I cannot find the place where this method is automagically added to the form?!
Any ideas?!
cheers stefan