gpi-active_model_serializers 0.8.4.alpha3 → 0.8.4.alpha4
Sign up to get free protection for your applications and to get access to all the features.
@@ -430,25 +430,32 @@ module ActiveModel
|
|
430
430
|
def attributes
|
431
431
|
puts "PARSING ATTRIBUTES"
|
432
432
|
|
433
|
-
_fast_attributes
|
433
|
+
hash = _fast_attributes
|
434
434
|
rescue NameError
|
435
435
|
method = "def _fast_attributes\n"
|
436
436
|
|
437
437
|
method << " h = {}\n"
|
438
438
|
|
439
439
|
_attributes.each do |name,key|
|
440
|
-
explicitly_included = @options.key?(:only) && Array(@options[:only]).include?(name)
|
441
|
-
|
442
|
-
puts "PARSING ATTRIBUTE: #{name} HIDDEN?: #{_hidden_attributes.include?(name)} INCLUDE?: #{explicitly_included}"
|
443
|
-
next if _hidden_attributes.include?(name) && !explicitly_included
|
444
440
|
method << " h[:\"#{key}\"] = read_attribute_for_serialization(:\"#{name}\") if include?(:\"#{name}\")\n"
|
445
441
|
end
|
446
442
|
method << " h\nend"
|
447
443
|
|
448
|
-
puts "METHOD: #{method}"
|
449
|
-
|
450
444
|
self.class.class_eval method
|
451
|
-
_fast_attributes
|
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}"
|
452
|
+
|
453
|
+
if _hidden_attributes.include?(name) && !explicitly_included
|
454
|
+
hash.except!(name)
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
hash
|
452
459
|
end
|
453
460
|
|
454
461
|
# Returns options[:scope]
|