def complex_constantize(str)
      occurrences = str.count('_')
      tokens      = str.split('_')
      matrix      = (2**occurrences).times.map { |n| ("%0#{occurrences}b" % n).chars }

      matrix.find do |row|
        chars = []
        tokens.each_with_index do |char, i|
          chars << char
          chars << ( row[i] == '0' ? '_' : '/' ) if i < row.size
        end

        active_record = chars.join('').camelize.safe_constantize
        break active_record if active_record
      end
    end
def complex_constantize(str)
      occurrences = str.count('_')
      tokens      = str.split('_')
      matrix      = (2**occurrences).times.map { |n| ("%0#{occurrences}b" % n).chars }

      matrix.find do |row|
        chars = []
        tokens.each_with_index do |char, i|
          chars << char
          chars << ( row[i] == '0' ? '_' : '/' ) if i < row.size
        end

        active_record = chars.join('').camelize.safe_constantize
        break active_record if active_record
      end
    end
0 : a
 0 : a_b
 1 : a/b
 0 0 : a_b_c
 0 1 : a_b/c
 1 0 : a/b_c
 1 1 : a/b/c
 0 0 0 : a_b_c_d
 0 0 1 : a_b_c/d
 0 1 0 : a_b/c_d
 0 1 1 : a_b/c/d
 1 0 0 : a/b_c_d
 1 0 1 : a/b_c/d
 1 1 0 : a/b/c_d
 1 1 1 : a/b/c/d