I’m working on stitching together the rails backend/api with a backbone.js web app I prototyped in isolation. Along the way, I started tinkering with – and quickly relying on – the ‘backbone-in-rails’ gem, which gives you a generator for a skeletal set of files for a backbone.js app within your rails app, and handles the asset pipeline.
I wasn’t sure what the benefit would be at first – I’ve already got a lot of js written, and I’m just integrating it all together. However, after about my second use of it, it really just became clear that it’s a nice time saver, an intuitive part of the rails workflow, and a good tool for keeping your namespacing and file system consistent.
There was a brief moment of hair-pulling, though, so I’m throwing this note out into the hive mind.
It’s not the worst thing that can happen – there is a rollback script, and it’s not a huge mess – but since the whole purpose of the gem is to save you from having to go touch half a dozen files to add a new model to your backbone.js app, it’s worth noting.
I know I should make the coffeescript plunge – and I will, someday, probably – but it’s really nice that this little time saver supports the old fashioned way for us old fashioned js hacks.