backbone_extensions 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,16 +53,11 @@
53
53
 
54
54
  function parseAssociation(associationType, associationName, options) {
55
55
  function parseResponseWith(key, response) {
56
- var camelized = _.str.camelize(key), underscored = _.str.underscored(key);
57
- if (response[camelized]) {
58
- return {key: camelized, response: response[camelized]};
59
- }
60
- else if (response[underscored]) {
61
- return {key: underscored, response: response[underscored]};
62
- }
63
- else {
64
- return {response: null};
65
- }
56
+ var parseKey;
57
+ return _([_.str.camelize, _.str.underscored]).any(function(fn) {
58
+ var k = fn(key);
59
+ return (parseKey = response[k] && {key: k, response: response[k]});
60
+ }) && parseKey || {response: null};
66
61
  }
67
62
 
68
63
  function through(response) {
@@ -114,7 +109,7 @@
114
109
  this._parsers.push({
115
110
  parseFn: parseFunc,
116
111
  associationFn: function(assocResponse) {
117
- associations[associationType].call(this, assocResponse, this[associationName](), mergeAssociationOptions(options, this.options));
112
+ associations[associationType].call(this, assocResponse, this[associationName](), mergeAssociationOptions(options, this._options));
118
113
  }
119
114
  });
120
115
  }
@@ -1,3 +1,3 @@
1
1
  module BackboneExtensions
2
- VERSION = "0.0.6"
2
+ VERSION = '0.0.7'
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.6
4
+ version: 0.0.7
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: 1650966973307354674
129
+ hash: -2212629205291919389
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: 1650966973307354674
138
+ hash: -2212629205291919389
139
139
  requirements: []
140
140
  rubyforge_project:
141
141
  rubygems_version: 1.8.24