Skip to content

A simple gem for using Backbone.js with Rails (>= 3.1), based on thoughtbot's 'Backbone.js on Rails'

License

Notifications You must be signed in to change notification settings

hanka/backbone-on-rails

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

B a c k b o n e   o n   R a i l s

}=}=}=}=}=}=}=}=}=}=}=}=}=}=}=}=}


  A simple gem for using Backbone.js with Rails (>= 3.1),
  based on thoughtbot's 'Backbone.js on Rails'.
  
  http://git.io/backbone-on-rails


Features
--------

  * Vendors the latest Backbone.js + Underscore.js in the asset pipeline

  * Provides an install generator to create a skeleton[1] directory 
    structure and manifest

  * Provides a scaffold generator to create files and boilerplate

  * Uses the naming conventions from
    thoughtbot's 'Backbone.js on Rails' http://bit.ly/pLsmzr

  * Generates CoffeeScript (default) or JavaScript


Usage
-----

  gem 'backbone-on-rails'

  bundle install

  rails generate backbone:install

  rails generate backbone:scaffold planet

  See also: http://railscasts.com/episodes/323-backbone-on-rails-part-1


Output
------

  Example output from backbone:scaffold planet

  app/assets/
  ├── javascripts
  │   ├── application.js
  │   ├── space_app.js.coffee
  │   ├── collections
  │   │   └── planets.js.coffee
  │   ├── models
  │   │   └── planet.js.coffee
  │   ├── routers
  │   │   └── planets.js.coffee
  │   └── views
  │       └── planets
  │           └── index.js.coffee
  └── templates
      └── planets
          └── index.jst.eco


Tricks
------
  
  # Custom manifest
  rails generate backbone:install --manifest index.js         

  # Namespaced install
  rails generate backbone:install --namespace solar_system    

  # Namespaced scaffold
  rails generate backbone:scaffold solar_system/planet
  
  # Generate JavaScript
  rails generate backbone:install --javascript         

  # Remove generated files
  rails destroy backbone:scaffold planet              


Alternatives
------------

  For other features check out:

  * https://github.com/codebrew/backbone-rails
  * https://github.com/aflatter/backbone-rails


[1] http://bit.ly/vylNJO

About

A simple gem for using Backbone.js with Rails (>= 3.1), based on thoughtbot's 'Backbone.js on Rails'

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 86.4%
  • JavaScript 7.1%
  • CoffeeScript 6.5%