Backbone.js and rails - BanLV
-
Upload
framgia-vietnam -
Category
Technology
-
view
806 -
download
2
description
Transcript of Backbone.js and rails - BanLV
BACKBONE.JS and RAILS
Name: Le Van Ban
What is Backbon.js?Why would you use Backbone.js?Component of backbone.jsHow to use backbone with rails?
What is Backbon.js?
• Backbone is a framework JS, a JavaScript library with a RESTfull Json interface
• Backbone was created by Jeremy Ashkenas.
Why would you use Backbone.js?
- Easier to build javascrip for web app - Easier to maintain
Code is clear Structure MVC
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
How to use backbone with rails?
Add “ gem 'rails-backbone' “ to GemfileInstall:
bundle installrails g backbone:installrails g scaffold Post title:string content:stringrake 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 )
DEMO
Tài liệu tham khảo
• http://backbonetutorials.com/• http://backbonejs.org/• https://github.com/codebrew/backbone-rails• http://perka.github.io/backbone-ui/