Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

CanJS and Ruby On Rails

$
0
0
I'm trying to use CanJS with Rails. I'm having issues with the files loading before the DOM has loaded. I've been looking at this example, which I've based my code from: canjs-mailclient-app

Please refer to this gist, which is what I've got so far.

So the application.mustache is working and printing to the DOM, which is great but its failing when trying to import the <toolbar> component. It seems like its running toolbar.js.coffee when the page first loads and doesn't do anything after that. This makes sense as the DOM doesn't have a <toolbar> element until app.js.coffee is executed, which is after the document is ready. I know this because if I 'console.log()' the toolbar.js.coffee will print out before app.js.coffee. But when I refer to the above example I can't see anything different to what I've got.

Can you tell me if I'm importing the files wrong within the asset pipeline of rails (application.js) or have I just got something simply wrong?



Viewing all articles
Browse latest Browse all 3491

Trending Articles