forked from meleyal/backbone-on-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
98 lines (62 loc) · 2.04 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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
Note:
Remember to restart the server after installing
See also:
http://railscasts.com/episodes/323-backbone-on-rails-part-1
http://railscasts.com/episodes/325-backbone-on-rails-part-2
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