BackboneJS

MVC

How does Backbone relate to «traditional» MVC?

Installation

Gemfile


Console

Structure

application.js

blog.js.coffee

UnderscoreJS


http://underscorejs.org/

Server side

Backbone scaffold

Model

What do they do?

Model

Model

Model

Views

What do they do?

Views

Views

index_view.js.coffee

Views

new_view.js.coffee

Render

Views


EJS

<% Embedded JavaScript %>


About.

EJS cleans the HTML out of your JavaScript with client side templates. After EJS gets its rubber gloves on dirty code, you'll feel organized and uncluttered.

Events

View

Router

Router

History

posts.js posts/index.html.erb

Associations

post.js.coffee

Nested attributes

in view

in model

Nested attributes


Validation


validate is called before set() and save()

Validation

/

#