Skip to content

Commit

Permalink
Fix: undefined method `parent' error
Browse files Browse the repository at this point in the history
  • Loading branch information
Hossam-Hawary committed Jun 12, 2022
1 parent ce475df commit 1f0b4b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/inputs/nested_select_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def instance_from_attribute_name(attribute)

attribute_camelized = attribute.to_s.chomp("_id").camelize
klass_without_namespace = attribute_camelized.safe_constantize
klass_with_namespace = "#{@object.class.parent}::#{attribute_camelized}".safe_constantize
klass_with_namespace = "#{@object.class.module_parent}::#{attribute_camelized}".safe_constantize
klass = klass_without_namespace || klass_with_namespace
klass.find_by_id(attribute_value)
end
Expand Down

0 comments on commit 1f0b4b8

Please sign in to comment.