<commit_before>module Para
  module Ext
    module SimpleFormExtension
      module SelectizeInput
        extend ActiveSupport::Concern

        included do
          alias_method_chain :name_for, :admin_name
        end

        def name_for_with_admin_name(option)
          Para.config.resource_name_methods.each do |method|
            if (name = option.try(method))
              return name
            end
          end
        end
      end<commit_msg>fix selectize extension option name when none is available<commit_after>module Para
  module Ext
    module SimpleFormExtension
      module SelectizeInput
        extend ActiveSupport::Concern

        included do
          alias_method_chain :name_for, :admin_name
        end

        def name_for_with_admin_name(option)
          Para.config.resource_name_methods.each do |method|
            if (name = option.try(method))
              return name
            end
          end

          if option.respond_to?(:model_name)
            [option.model_name.human, option.id].join(' - ')
          else
            option.to_s
          end
        end
      end
{'fraction_non_alphanumeric': 0.05323868677905945, 'fraction_numerical': 0.0, 'mean_word_length': 1.7920792079207921, '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': '2632925', 'n_tokens_mistral': 297, 'n_tokens_neox': 289, 'n_words': 74}