Dynamic file paths in FileColumn


I have a file uploader application in ROR using the very nice FileColumn
plugin. In looking at the source code I can see that there is a
DEFAULT_OPTION hash with some root path options and such which can be
merged from an options paramater. These static path changes are not a

My question is dynamic path options. My upload form, when you boil it
down, has two fields. The first is the ‘file_column_field’ form helper
which grabs the file off the harddrive and adds its filename to a :path
attribute of the Model. The second is a drop down which selects from a
list of publications that the file belongs to. This gets written to the
:publication attribute in the Model. Id like to pass the :publication
value to FileColumn so that is can use it in the path. Being a rather
poor hobby coder, I am sure that I am missing something very basic.

Here is what I have. When I run it I get the error ‘Cannot convert
Symbol to String’

<%= form_tag ( { :action => “post” }, { :multipart => true })%>
<%= collection_select(:xml, :publication_id, @publications, :id,
XML File:
<%= file_column_field “xml”, “path” %>
<%= submit_tag(value = “Create new article”) %>
<%= end_form_tag %>

class UploadController < ApplicationController
@xml = Xml.new(@params[:xml])

class Xml < ActiveRecord::Base
file_column :path, {:pub => :publication_id}

#small change to FileColumn (appologies to Mr. Kanthak)
module FileColumn # :nodoc:

def self.init_options(defaults, attr)
options = defaults.dup
options[:store_dir] ||= File.join(options[:root_path],
options[:tmp_base_dir] ||= File.join(options[:store_dir], “tmp”)
options[:base_url] ||= options[:web_root] + File.join(attr)
FileUtils.mkpath([ options[:store_dir], options[:tmp_base_dir] ])

def file_column(attr, options={})
options = DEFAULT_OPTIONS.merge(options) if options
my_options = FileColumn::init_options(options,


Thanks in advance