Skip to content

Commit 552fd6a

Browse files
Merge pull request #13 from Sage/bugfix_fix_alias_recursion
added bugfix to resolve issue with alias recursion
2 parents 9dcc3c8 + ceaa57f commit 552fd6a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/class_kit/helper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ def to_hash(object, use_alias = false)
2929
value = object.public_send(attribute[:name])
3030
if value != nil
3131
hash[key] = if is_class_kit?(type)
32-
to_hash(value)
32+
to_hash(value, use_alias)
3333
elsif type == Array
3434
value.map do |i|
3535
if is_class_kit?(i.class)
36-
to_hash(i)
36+
to_hash(i, use_alias)
3737
else
3838
i
3939
end
@@ -62,14 +62,14 @@ def from_hash(hash:, klass:, use_alias: false)
6262
next if hash[key].nil?
6363

6464
value = if is_class_kit?(type)
65-
from_hash(hash: hash[key], klass: type)
65+
from_hash(hash: hash[key], klass: type, use_alias: use_alias)
6666
elsif type == Array
6767
hash[key].map do |array_element|
6868
if attribute[:collection_type].nil?
6969
array_element
7070
else
7171
if is_class_kit?(attribute[:collection_type])
72-
from_hash(hash: array_element, klass: attribute[:collection_type])
72+
from_hash(hash: array_element, klass: attribute[:collection_type], use_alias: use_alias)
7373
else
7474
@value_helper.parse(type: attribute[:collection_type], value: array_element)
7575
end

0 commit comments

Comments
 (0)