def draw_file(f, col_or_sym, options={})
      col_name  = get_column_name(col_or_sym)
      file_info = FileInfo.safe_find(f.object.send(col_name))
      error_wrapping(
        if file_info
          file_field_dom    = "file_info_#{col_name}_uploaded_data"
          file_link_dom     = "file_info_#{col_name}_link"

          file_field_sub(col_name, file_info, options.merge(:style=>'display:none')) +
          ' ' +
          content_tag(:span, :id=>file_link_dom) do
            link_to(file_info.filename,
                {:action    => 'file_download',
                 :id        => f.object.id,
                 :column    => col_name}) + ' ' +
            link_to_function("[#{t('edgarj.default.clear')}]",
                sprintf("Edgarj.clear_file('%s', '%s', '%s')",
                    file_field_dom,
                    "#{f.object_name}_#{col_name}",
                    file_link_dom))
          end +
          f.hidden_field(col_name)
        else
          file_field_sub(col_name, FileInfo.new, options)
        end, f.object.errors.on(col_name)
      )
    end
def draw_file(f, col_or_sym, options={})
      col_name  = get_column_name(col_or_sym)
      file_info = FileInfo.safe_find(f.object.send(col_name))
      error_wrapping(
        if file_info
          file_field_dom    = "file_info_#{col_name}_uploaded_data"
          file_link_dom     = "file_info_#{col_name}_link"

          file_field_sub(col_name, file_info, options.merge(:style=>'display:none')) +
          ' ' +
          content_tag(:span, :id=>file_link_dom) do
            link_to(file_info.filename,
                {:action    => 'file_download',
                 :id        => f.object.id,
                 :column    => col_name}) + ' ' +
            link_to_function("[#{t('edgarj.default.clear')}]",
                sprintf("Edgarj.clear_file('%s', '%s', '%s')",
                    file_field_dom,
                    "#{f.object_name}_#{col_name}",
                    file_link_dom))
          end +
          f.hidden_field(col_name)
        else
          file_field_sub(col_name, FileInfo.new, options)
        end, f.object.errors.on(col_name)
      )
    end
Field 'file_NN' in AR is handled as file attachement(upload/download) in Edgarj.
 Where, NN is 2-digits from 00 to 99.

 draw_file() helper draws file attachment(upload/download) user-interface
 for file_NN field.  It supports:

 1. upload file          (Create)
 1. download file        (Read)
 1. upload another file  (Update)
 1. clear the field      (Delete)

 === Model
 Integer value of file_NN column in any AR is interpreted a ID value
 to point to a FileInfo record.
 As NN means, any number of files (max 100) can be attached to any AR.

 belongs_to/has_one relation can be declared between the AR and FileInfo,
 but it is not required.  Those declarations are just for your
 customization level convenience.

 attr_accessible(or attr_protected) to hide file_NN from mass-assignment
 *SHOULD BE* applied.

 See Report model unit test for testing.

 === INPUTS
 f::           Form builder object.
 col_or_sym::  column object returned by rec.class.columns, or symbol
 options::     passed to select helper.

 === EXAMPLE
 draw_file(f, :file_00) draws:

   <input type=file id='file_info[file_00][uploaded_data]' ...>

 === SEE ALSO
 ActiveRecord::Base#upsert_file_NN