<commit_before>module WulinMaster
  module GridRelation
    extend ActiveSupport::Concern
    
    module ClassMethods
      # Set master grid, invoked from grid.apply_custom_config method
      def master_grid(grid_klass, options={})
        if options[:screen]
          detail_model = self.model
          master_grid = grid_klass.constantize.new({screen: options[:screen]})
          through = options[:through] || detail_model.reflections[master_grid.model.to_s.downcase.intern].foreign_key

          # call affiliation behavior
          behavior :affiliation, master_grid_name: master_grid.name, only: [options[:screen].intern], through: through
        end
      end
    end
    
    # ----------------------------- Instance Methods ------------------------------------
    
  end
end<commit_msg>MISC - improved the association key finding logic for master-detail grids relation<commit_after>module WulinMaster
  module GridRelation
    extend ActiveSupport::Concern
    
    module ClassMethods
      # Set master grid, invoked from grid.apply_custom_config method
      def master_grid(grid_klass, options={})
        if options[:screen]
          detail_model = self.model
          master_grid = grid_klass.constantize.new({screen: options[:screen]})
          through = options[:through] || detail_model.reflections[master_grid.model.to_s.underscore.intern].foreign_key

          # call affiliation behavior
          behavior :affiliation, master_grid_name: master_grid.name, only: [options[:screen].intern], through: through
        end
      end
    end
    
    # ----------------------------- Instance Methods ------------------------------------
    
  end
end
{'fraction_non_alphanumeric': 0.14991076740035694, 'fraction_numerical': 0.0, 'mean_word_length': 2.25968992248062, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '807496', 'n_tokens_mistral': 424, 'n_tokens_neox': 416, 'n_words': 101}