-
Notifications
You must be signed in to change notification settings - Fork 124
How is this gem different to backbone rails?
In response to: http://news.ycombinator.com/item?id=3214955
The main focus was to follow the naming conventions from thoughtbot and keep it simple.
The specific differences are:
- Different naming conventions
- Fewer generators
- Generates Coffee or JS
The backbone-rails gem creates the following structure (using the default install + scaffold commands):
app/assets/
├── javascripts
├── application.js
└── backbone
├── my_app.js.coffee
├── models
│ └── cat.js.coffee
├── routers
│ └── cats_router.js.coffee
├── templates
│ └── cats
│ ├── cat.jst.ejs
│ ├── edit.jst.ejs
│ ├── index.jst.ejs
│ ├── new.jst.ejs
│ └── show.jst.ejs
└── views
└── cats
├── cat_view.js.coffee
├── edit_view.js.coffee
├── index_view.js.coffee
├── new_view.js.coffee
└── show_view.js.coffee
This gem creates the following structure (using the default install + scaffold commands):
app/assets/
├── javascripts
│ ├── application.js
│ ├── my_app.js.coffee
│ ├── collections
│ │ └── cats.js.coffee
│ ├── models
│ │ └── cat.js.coffee
│ ├── routers
│ │ └── cats_router.js.coffee
│ └── views
│ └── cats
│ └── cats_index.js.coffee
└── templates
└── cats
└── index.jst.eco
Why? I prefer the thoughtbot conventions as they are closer to what I was creating myself manually.
backbone-rails provides rails-like generators for each component (model, router, etc.).
This gem has only two generators, one for setting up the project structure (backbone:install), and one that creates all the files for a single resource in one go with minimal boilerplate (backbone:scaffold).
Why? This was done mainly for simplicity, to keep the gem easy to maintain.
Files can be generated as CoffeeScript (.js.coffee) or JavaScript (.js).
Why? The simple generators made it easy to add support for both.