2.
What is Backbon.js?
Why would you use Backbone.js?
Component of backbone.js
How to use backbone with rails?
3. What is Backbon.js?
• Backbone is a framework JS, a
JavaScript library with a RESTfull Json interface
• Backbone was created by Jeremy Ashkenas.
4. Why would you use Backbone.js?
- Easier to build javascrip for web app
- Easier to maintain
Code is clear
Structure MVC
5. Component of backbone.js
Router
View: used to listen to events and react accordingly
Model: containing the interactive data
Collection: an ordered set of models
6. How to use backbone with rails?
Add “ gem 'rails-backbone' “ to Gemfile
Install:
bundle install
rails g backbone:install
rails g scaffold Post title:string content:string
rake db:migrate
rails g backbone:scaffold Post title:string content:string
( rails g backbone:model - model and collection
rails g backbone:router - views and templates )