File_column with both root_path and store_dir

I store my file_column database outside of my RAILS_ROOT.

It seems to work in real life, but not in tests.

In the tests, I can’t set both the root_path and the store_dir. In
tests, setting the store_dir option will override the root_path
option. The only way for root_path to work is to remove store_dir. I
think the problem is in file_column.rb on line 22:
options[:store_dir] ||= File.join(options[:root_path], model, attr)

Here’s my test:

def test_absolute_path_outside_rails_root
# We might want to store our files on another file system
# We also want to give the user their own directory
Entry.file_column :image, {:root_path => “/u/
file_column_db”, :store_dir => store_dir_method}
e = Entry.new
e.image = uploaded_file(file_path(“kerb.jpg”), “image/jpeg”,
“kerb.jpg”)
assert File.exists?(e.image)
assert e.image !~ /../, “#{e.image} is not a simple path”
assert_match %r{/u/file_column_db/somebodys_account/images},
e.image
end
def store_dir_method
File.join(“somebodys_account”, “images”)
end

This fails with:

  1. Failure:
    test_absolute_path_outside_rails_root(ResourceTest) [test/unit/
    resource_test.rb:254]:
    <"/usr/home/ryenski/sites/my_app/somebodys_account/images/tmp/
    1137483590.895686.58774/kerb.jpg"> expected to be =~
    <//u/file_column_db/somebodys_account/images/>.

Any ideas would be appreciated!
Thanks,
Ryan