lib/active_scaffold/helpers/search_column_helpers.rb
# This method decides which input to use for the given column.
# It does not do any rendering. It only decides which method is responsible for rendering.
This method decides which input to use for the given column.
It does not do any rendering. It only decides which method is responsible for rendering.
This method decides which input to use for the given column . It does not do any rendering . It only decides which method is responsible for rendering .
def active_scaffold_search_for(column, options = nil)
        options ||= active_scaffold_search_options(column)
        record = options[:object]
        if column.delegated_association
          record = record.send(column.delegated_association.name) || column.active_record_class.new
          options[:object] = record
        end
        if (method = override_search_field(column))
          send(method, record, options)
        elsif column.search_ui && (method = override_search(column.search_ui))
          send(method, column, options)
        elsif column.search_ui && (method = override_input(column.search_ui))
          send(method, column, options)
        elsif (method = override_form_field(column))
          send(method, record, options)
        elsif column.association || column.virtual?
          active_scaffold_search_text(column, options)
        elsif (method = override_search(column.column.type))
          send(method, column, options)
        elsif (method = override_input(column.column.type))
          send(method, column, options)
        else 
          text_types = %i[text string integer float decimal]
          options = active_scaffold_input_text_options(options) if text_types.include?(column.column.type)
          text_field(:record, column.name, options.merge(column.options))
        end
      rescue StandardError => e
        logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}"
        raise e
      end
def active_scaffold_search_for ( column , options = nil ) options ||= active_scaffold_search_options ( column ) record = options [ :object ] if column . delegated_association record = record . send ( column . delegated_association . name ) || column . active_record_class . new options [ :object ] = record end if ( method = override_search_field ( column ) ) send ( method , record , options ) elsif column . search_ui && ( method = override_search ( column . search_ui ) ) send ( method , column , options ) elsif column . search_ui && ( method = override_input ( column . search_ui ) ) send ( method , column , options ) elsif ( method = override_form_field ( column ) ) send ( method , record , options ) elsif column . association || column . virtual? active_scaffold_search_text ( column , options ) elsif ( method = override_search ( column . column . type ) ) send ( method , column , options ) elsif ( method = override_input ( column . column . type ) ) send ( method , column , options ) else text_types = %i[ text string integer float decimal ] options = active_scaffold_input_text_options ( options ) if text_types . include? ( column . column . type ) text_field ( :record , column . name , options . merge ( column . options ) ) end rescue StandardError => e logger . error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}" raise e end
This method decides which input to use for the given column.
This method decides which input to use for the given column .
# first, check if the dev has created an override for this specific field for search # second, check if the dev has specified a valid search_ui for this column, using specific ui for searches # third, check if the dev has specified a valid search_ui for this column, using generic ui for forms # fourth, check if the dev has created an override for this specific field # fallback: we get to make the decision # if we (or someone else) have created a custom render option for the column type, use that # if we (or someone else) have created a custom render option for the column type, use that # final ultimate fallback: use rails' generic input method # for textual fields we pass different options
column
<not_specific>
options
<not_specific>