backbone_extensions 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -143,7 +143,10 @@
143
143
 
144
144
  extend: _(source.extend).wrap(function(oldExtend, protoProps, classProps) {
145
145
  return _(oldExtend.call(this, protoProps, classProps)).tap(function() {
146
- source.associations((protoProps || {}).associations);
146
+ var args = (protoProps || {}).associations;
147
+ if (args) {
148
+ source.associations.apply(source, _([args]).flatten());
149
+ }
147
150
  });
148
151
  })
149
152
  });
@@ -6,9 +6,8 @@
6
6
  }
7
7
 
8
8
  function wrapDecorator(fnName) {
9
- var Klass = this;
10
9
  return function() {
11
- var args = arguments;
10
+ var Klass = this.constructor, args = arguments;
12
11
  if (_(this._decoratee).isArray()) {
13
12
  return _(this._decoratee).map(function(model) {
14
13
  return (Klass.fn[fnName]).apply(model, args);
@@ -25,8 +24,8 @@
25
24
  .chain()
26
25
  .omit('collection', 'constructor', 'initialize', 'model'),
27
26
  wrapped = proto.reduce(function(proto, fn, name) {
28
- return (proto[name] = wrapDecorator.call(this, name)) && proto;
29
- }, {}, this).value();
27
+ return (proto[name] = wrapDecorator(name)) && proto;
28
+ }, {}).value();
30
29
  this.fn = proto.value();
31
30
  return _(Backbone.Model.extend.call(this, _(protoProps).extend(wrapped), classProps)).tap(function(Klass) {
32
31
  _(['model', 'collection']).each(function(type) {
@@ -1,3 +1,3 @@
1
1
  module BackboneExtensions
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
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.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-13 00:00:00.000000000 Z
13
+ date: 2013-01-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fuubar
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: -2349636657687252698
129
+ hash: 806858613652291946
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: -2349636657687252698
138
+ hash: 806858613652291946
139
139
  requirements: []
140
140
  rubyforge_project:
141
141
  rubygems_version: 1.8.24