angularjs-rails-resource 0.2.5 → 1.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -207,7 +207,7 @@
207
207
  * Specify a custom serializer to use for an attribute.
208
208
  *
209
209
  * @param attributeName {string} The name of the attribute
210
- * @param serializer {string | constructor} A reference to the custom serializer to use for the attribute.
210
+ * @param serializer {string | function} A reference to the custom serializer to use for the attribute.
211
211
  * @returns {Serializer} this for chaining support
212
212
  */
213
213
  Serializer.prototype.serializeWith = function (attributeName, serializer) {
@@ -263,17 +263,8 @@
263
263
  Serializer.prototype.getSerializedAttributeName = function (attributeName) {
264
264
  var mappedName = this.serializeMappings[attributeName] || attributeName;
265
265
 
266
- var mappedNameExcluded = this.isExcludedFromSerialization(mappedName),
267
- attributeNameExcluded = this.isExcludedFromSerialization(attributeName);
268
-
269
- if(this.options.excludeByDefault) {
270
- if(mappedNameExcluded && attributeNameExcluded) {
271
- return undefined;
272
- }
273
- } else {
274
- if (mappedNameExcluded || attributeNameExcluded) {
275
- return undefined;
276
- }
266
+ if (this.isExcludedFromSerialization(attributeName) || this.isExcludedFromSerialization(mappedName)) {
267
+ return undefined;
277
268
  }
278
269
 
279
270
  return this.underscore(mappedName);
@@ -338,9 +329,9 @@
338
329
 
339
330
  // custom serializer takes precedence over resource serializer
340
331
  if (serializer) {
341
- return RailsResourceInjector.createService(serializer);
332
+ return RailsResourceInjector.createService(serializer)
342
333
  } else if (resource) {
343
- return resource.serializer;
334
+ return resource.config.serializer;
344
335
  }
345
336
 
346
337
  return undefined;
@@ -452,7 +443,7 @@
452
443
  result = {};
453
444
 
454
445
  if (Resource) {
455
- result = new Resource();
446
+ result = new Resource.config.resourceConstructor();
456
447
  }
457
448
 
458
449
  angular.forEach(data, function (value, key) {
@@ -33,7 +33,7 @@
33
33
  return function (url) {
34
34
  var expression;
35
35
 
36
- if (angular.isFunction(url)) {
36
+ if (angular.isFunction(url) || angular.isUndefined(url)) {
37
37
  return url;
38
38
  }
39
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angularjs-rails-resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 1.0.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Odom
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-24 00:00:00.000000000 Z
12
+ date: 2013-10-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A small AngularJS add-on for integrating with Rails via JSON more easily.
15
15
  email:
@@ -80,9 +80,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - '>'
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 1.3.1
86
86
  requirements: []
87
87
  rubyforge_project:
88
88
  rubygems_version: 2.0.6