gpi-active_model_serializers 0.8.4.alpha4 → 0.8.4.alpha5

Sign up to get free protection for your applications and to get access to all the features.
@@ -428,34 +428,23 @@ module ActiveModel
428
428
  # Returns a hash representation of the serializable
429
429
  # object attributes.
430
430
  def attributes
431
- puts "PARSING ATTRIBUTES"
432
-
433
- hash = _fast_attributes
431
+ _fast_attributes
434
432
  rescue NameError
435
433
  method = "def _fast_attributes\n"
436
434
 
437
435
  method << " h = {}\n"
438
436
 
439
437
  _attributes.each do |name,key|
440
- method << " h[:\"#{key}\"] = read_attribute_for_serialization(:\"#{name}\") if include?(:\"#{name}\")\n"
438
+ method << " if include?(:\"#{name}\") && (!_hidden_attributes.include?(:\"#{name}\") || (@options.key?(:only) && Array(@options[:only]).include?(:\"#{name}\")))\n"
439
+ method << " h[:\"#{key}\"] = read_attribute_for_serialization(:\"#{name}\")\n"
440
+ method << " end\n"
441
441
  end
442
442
  method << " h\nend"
443
443
 
444
- self.class.class_eval method
445
- hash = _fast_attributes
446
-
447
- puts "FAST ATTRIBUTES: #{hash}"
448
-
449
- _hidden_attributes.each do |name|
450
- explicitly_included = @options.key?(:only) && Array(@options[:only]).include?(name)
451
- puts "HIDDEN ATTRIBUTE: #{name} INCLUDE?: #{explicitly_included}"
444
+ puts "METHOD: #{method}"
452
445
 
453
- if _hidden_attributes.include?(name) && !explicitly_included
454
- hash.except!(name)
455
- end
456
- end
457
-
458
- hash
446
+ self.class.class_eval method
447
+ _fast_attributes
459
448
  end
460
449
 
461
450
  # Returns options[:scope]
@@ -1,5 +1,5 @@
1
1
  module ActiveModel
2
2
  class Serializer
3
- VERSION = "0.8.4.alpha4"
3
+ VERSION = "0.8.4.alpha5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpi-active_model_serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4.alpha4
4
+ version: 0.8.4.alpha5
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: