backbone_extensions 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,7 +28,7 @@
28
28
 
29
29
  function createAssociation() {
30
30
  var self = this, collectionName = _.str.classify(associationName), className = options.className && _.str.classify(options.className),
31
- newOptions = fn.mergeOptions(options, globalOptions, this._options);
31
+ newOptions = fn.mergeOptions(globalOptions, options, this._options);
32
32
 
33
33
  if (options.inverseOf) {
34
34
  newOptions[_.str.camelize(options.inverseOf)] = function() { return self; };
@@ -70,6 +70,10 @@
70
70
  }
71
71
 
72
72
  if (options.parse) {
73
+ if (!_(this).has('_parsers')) {
74
+ this._parsers = [];
75
+ }
76
+
73
77
  var associations = {
74
78
  hasMany: function(assocResponse, association, newOptions) {
75
79
  association.add(assocResponse, newOptions);
@@ -112,7 +116,7 @@
112
116
  },
113
117
  associationFn: function(assocResponse) {
114
118
  return assocResponse &&
115
- associations[associationType].call(this, assocResponse, this[associationName](), fn.mergeOptions(options, globalOptions, this._options));
119
+ associations[associationType].call(this, assocResponse, this[associationName](), fn.mergeOptions(globalOptions, options, this._options));
116
120
  }
117
121
  });
118
122
  }
@@ -127,10 +131,7 @@
127
131
  }).reduce(function(associations, defaultOptions, associationType) {
128
132
  associations[associationType] = function(name, options) {
129
133
  var associationName = _.str.camelize(name);
130
- options = _({}).extend(defaultOptions, options);
131
- if (options.parse && !_(this).has('_parsers')) {
132
- this._parsers = [];
133
- }
134
+ options = _({}).extend(defaultOptions, globalOptions, options);
134
135
  fn.buildAssociation.call(this, associationType, associationName, options);
135
136
  fn.parseAssociation.call(this, associationType, associationName, options);
136
137
  return this;
@@ -1,3 +1,3 @@
1
1
  module BackboneExtensions
2
- VERSION = '0.0.18'
2
+ VERSION = '0.0.19'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backbone_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: 1206709655256402287
129
+ hash: -3332237154857686362
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements:
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  segments:
137
137
  - 0
138
- hash: 1206709655256402287
138
+ hash: -3332237154857686362
139
139
  requirements: []
140
140
  rubyforge_project:
141
141
  rubygems_version: 1.8.24