File column plugin with ActiveScaffold upload branch

When using the file_column plugin in the active_scaffold upload branch, the documentation in the file_column doesn’t make it clear what we have to change to make it work.

In the example below the model is number and the file_column is intro.

1. In models/number.rb add:

file_column :intro

2. in controllers/numbers_controller.rb, make sure we have:

config.create.multipart = true
config.update.multipart = true

3. in helpers/numbers_helper.rb add:

def intro_form_column(record, input name)
  file_column_field 'record', :intro
end

def intro_column(record)
  record.intro ? link_to(File.basename(record.intro),
    url_for_file_column(record,'intro'), :popup => true) : "-"
end

4. in views/numbers/_intro_form_column.rhtml add:


  <%= file_column_field  'record', 'intro' %>