Ben Pickles. Saying stuff about stuff.


Last week I put together a Gem for use with the new Rails 3.1 asset pipeline, it packages up js-model and means you'll never have right-click-save-as-move-to-directory ever again. Now all you have to do is include it in your Gemfile:

gem 'js-model-rails'

And require js-model in your application.js:

//= require js-model

Being able to manage JavaScript and CSS dependencies using Gems is a nice feature but it really starts to get interesting when you consider how a little backend integration can ease your frontend development. For instance, at the moment js-model-rails does something I always forget to do myself:

config.active_record.include_root_in_json = false

But in the future it'll read your include_root_in_json setting and configure the JavaScript accordingly.

There are so many areas where having access to the backend environment will make working on the frontend much simpler. I'm not suggesting that every JavaScript library needs a corresponding Gem but in this case - and no doubt many others - it's the start of a beautiful friendship.

Here's the source on Github.

Posted on