Sha256: de20d39e9d4b0429bb6d4161a19b30344248bef3bbb49cbe12cb9959e3a7ef14

Contents?: true

Size: 1.73 KB

Versions: 2

Compression:

Stored size: 1.73 KB

Contents

What Does it do?
================

Compatible with Rails 3.0.x (Rails 3.1.x support is coming).

backbonejs-rails is similar to [jquery-rails](https://github.com/JangoSteve/jquery-rails). It adds the Javascript files that you need to create an application that uses [backbone.js](http://documentcloud.github.com/backbone/) as a JavaScript MVC. This gem will get the most recent version of these files from their master branches on github.

These are:

* backbone.js
* backbone.min.js
* underscore.js
* underscore.min.js
* json2.js

For templates I have included [ICanHaz.js](http://icanhazjs.com/)

* icanhaz.js
* icanhaz.min.js

Upon installation the files are added to your javascript defaults so that you can still use the following in your views/layouts/application.html.erb file:

    <%= javascript_include_tag :defaults %>
    
What else?
----------

It also creates a file called "config/initializers/backbone.rb" which contains the line:

    ActiveRecord::Base.include_root_in_json = false
    
Which is what you need to return JSON to Backbone the way it likes it. Otherwise you would need to do something like this:
    
    def create
        render :json => Person.create(:name => params[:name], :age => params[:age])
    end

Installation
------------

The best way to install backbonejs-rails is by adding the following to your Gemfile:
    
    gem "jquery-rails"
    gem "backbonejs-rails", "~> 0.0.3"

Then use Bundler to install:

    $ bundle install

Usage
-------

    $ rails g jquery:install
    $ rails g backbonejs:install

If you have already installed jquery and removed prototype then you can skip that step.

You can find my [screencast on Backbone.js and Rails 3 here](http://andrewgertig.com/2011/05/rails-backbone-js-example-screencast/)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
backbonejs-rails-0.0.5 README.md
backbonejs-rails-0.0.4 README.md