Skip to content

szarski/Backbone-On-Rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Backbone On Rails

This is an attempt to create a backbone.js adapter for Ruby On Rails. It is something I just wrote to make some code work for me. Not very well thought through.

What does it do?

Problem:

What Rails expects on users/update:

{:user => {:name => "Jacek"}}

What Backbone sends:

{:name => "Jacek"}

What Rails generates on users/show:

{:user => {:name => "Jacek"}}

What Backbone expects:

{:name => "Jacek"}

Solution:

The adapter overrides Backbone.Model.prototype.parse method to include nesting.

Quote form backbone.js:

    // **parse** converts a response into the hash of attributes to be `set` on
    // the model. The default implementation is just to pass the response along.
    parse : function(resp) {
      return resp;
    },

Installation

Just link the file after linking backbone.js

About

Ruby On Rails Backbone.js adapter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published