Coder Social home page Coder Social logo

backbone-nested-attributes's People

Contributors

hengwoon avatar lsimoneau avatar sobrinho avatar vicentemundim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backbone-nested-attributes's Issues

Deep nested attributes wont set as a collection

I have an orders collection filled with order models. Each order model has a collection of lineitems. I have a Backbone.NestedAttributesModel for each model (orders, order, lineitems, lineitem), however, the lineitems are not being set as a collection -- it is still just a plain array in the Order Model. Any ideas?

Here are my models:

C.Collections.Orders = Backbone.NestedAttributesModel.extend({
  relations: [
        {
          key: 'order',
          relatedModel: function () { return C.Models.Order }
        }
    ],
});

C.Models.Order = Backbone.NestedAttributesModel.extend({
    idAttribute: "_id",
    relations: [
        {
          key: 'lineitems',
          relatedModel: function () { return C.Collections.LineItems }
        }
    ]
});

C.Collections.LineItems = Backbone.NestedAttributesModel.extend({
  relations: [
        {
          key: 'lineitem',
          relatedModel: function () { return C.Models.LineItem }
        }
    ]
});

C.Models.LineItem = Backbone.NestedAttributesModel.extend({
    idAttribute: "_id"
});

saving the parent model with blank nested model

I am using some form code to create and update a model. This gem has worked great for updating but I need to create a new one and the nested model needs to be blank because the server creates it with an after_save callback.

Does this gem allow for blank nested models or is there something I can do to make that still work?

[enhancement] Add missing bower.json.

Hey, maintainer(s) of dtmtec/backbone-nested-attributes!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library dtmtec/backbone-nested-attributes is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "dtmtec/backbone-nested-attributes",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

Propagate parse option to nested models

Example:

Schedule = Backbone.Model.extend({
  parse: function (attributes) {
    attributes.at = moment(attributes.at);

    return attributes;
  }
});

Agenda = Backbone.NestedModel.extend({
  relations: [
    {
      type: "one",
      key: "schedule",
      relatedModel: function () { return Schedule }
    }
  ],

  parse: function (attributes) {
    attributes.created_at = moment(attributes.created_at);

    return attributes;
  }
});

new Agenda(window.agenda, { parse: true });

Agenda.prototype.parse is called but Schedule.prototype.parse don't.

Do you think that makes sense to propagate the options from the higher model to lower models?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.