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_select(column, html_options, options = {})
        record = html_options.delete(:object)
        associated = html_options.delete :value
        if column.association
          associated = associated.is_a?(Array) ? associated.map(&:to_i) : associated.to_i unless associated.nil?
          method = column.association.belongs_to? ? column.association.foreign_key : column.name
          select_options = sorted_association_options_find(column.association, false, record)
        else
          method = column.name
          select_options = active_scaffold_enum_options(column, record).collect do |text, value|
            active_scaffold_translated_option(column, text, value)
          end
        end
        options = options.merge(:selected => associated).merge column.options
        html_options.merge! column.options[:html_options] || {}
        if html_options[:multiple]
          active_scaffold_select_name_with_multiple html_options
        else
          options[:include_blank] ||= as_(:_select_)
          active_scaffold_translate_select_options(options)
        end
        if (optgroup = options.delete(:optgroup))
          select(:record, method, active_scaffold_grouped_options(column, select_options, optgroup), options, html_options)
        elsif column.association
          collection_select(:record, method, select_options, :id, column.options[:label_method] || :to_label, options, html_options)
        else
          select(:record, method, select_options, options, html_options)
        end
      end
def active_scaffold_search_select ( column , html_options , options = { } ) record = html_options . delete ( :object ) associated = html_options . delete :value if column . association associated = associated . is_a? ( Array ) ? associated . map ( & :to_i ) : associated . to_i unless associated . nil? method = column . association . belongs_to? ? column . association . foreign_key : column . name select_options = sorted_association_options_find ( column . association , false , record ) else method = column . name select_options = active_scaffold_enum_options ( column , record ) . collect do | text , value | active_scaffold_translated_option ( column , text , value ) end end options = options . merge ( :selected => associated ) . merge column . options html_options . merge! column . options [ :html_options ] || { } if html_options [ :multiple ] active_scaffold_select_name_with_multiple html_options else options [ :include_blank ] ||= as_ ( :_select_ ) active_scaffold_translate_select_options ( options ) end if ( optgroup = options . delete ( :optgroup ) ) select ( :record , method , active_scaffold_grouped_options ( column , select_options , optgroup ) , options , html_options ) elsif column . association collection_select ( :record , method , select_options , :id , column . options [ :label_method ] || :to_label , options , html_options ) else select ( :record , method , select_options , options , html_options ) end end
This method decides which input to use for the given column.
This method decides which input to use for the given column .
column
<not_specific>
html_options
<not_specific>
options
<not_specific>