Fix some deprecation warnings in the file_column plugin
This commit is contained in:
parent
7901815718
commit
14ba9f0a37
2 changed files with 10 additions and 10 deletions
|
@ -517,7 +517,7 @@ module FileColumn # :nodoc:
|
|||
#
|
||||
# FileColumn's storage location is determined in the following way. All
|
||||
# files are saved below the so-called "root_path" directory, which defaults to
|
||||
# "RAILS_ROOT/public". For every file_column, you can set a separte "store_dir"
|
||||
# "Rails.root/public". For every file_column, you can set a separte "store_dir"
|
||||
# option. It defaults to "model_name/attribute_name".
|
||||
#
|
||||
# Files will always be stored in sub-directories of the store_dir path. The
|
||||
|
@ -593,7 +593,7 @@ module FileColumn # :nodoc:
|
|||
|
||||
# default options. You can override these with +file_column+'s +options+ parameter
|
||||
DEFAULT_OPTIONS = {
|
||||
:root_path => File.join(RAILS_ROOT, "public"),
|
||||
:root_path => File.join(Rails.root, "public"),
|
||||
:web_root => "",
|
||||
:mime_extensions => MIME_EXTENSIONS,
|
||||
:extensions => EXTENSIONS,
|
||||
|
|
16
vendor/plugins/file_column/lib/test_case.rb
vendored
16
vendor/plugins/file_column/lib/test_case.rb
vendored
|
@ -32,9 +32,9 @@ class Test::Unit::TestCase
|
|||
uploaded_file(path, content_type, File.basename(path), type)
|
||||
end
|
||||
|
||||
# Copies the fixture files from "RAILS_ROOT/test/fixtures/file_column" into
|
||||
# Copies the fixture files from "Rails.root/test/fixtures/file_column" into
|
||||
# the temporary storage directory used for testing
|
||||
# ("RAILS_ROOT/test/tmp/file_column"). Call this method in your
|
||||
# ("Rails.root/test/tmp/file_column"). Call this method in your
|
||||
# <tt>setup</tt> methods to get the file fixtures (images, for example) into
|
||||
# the directory used by file_column in testing.
|
||||
#
|
||||
|
@ -70,14 +70,14 @@ class Test::Unit::TestCase
|
|||
# # ...
|
||||
# end
|
||||
def setup_fixture_files
|
||||
tmp_path = File.join(RAILS_ROOT, "test", "tmp", "file_column")
|
||||
file_fixtures = Dir.glob File.join(RAILS_ROOT, "test", "fixtures", "file_column", "*")
|
||||
tmp_path = File.join(Rails.root, "test", "tmp", "file_column")
|
||||
file_fixtures = Dir.glob File.join(Rails.root, "test", "fixtures", "file_column", "*")
|
||||
|
||||
FileUtils.mkdir_p tmp_path unless File.exists?(tmp_path)
|
||||
FileUtils.cp_r file_fixtures, tmp_path
|
||||
end
|
||||
|
||||
# Removes the directory "RAILS_ROOT/test/tmp/file_column/" so the files
|
||||
# Removes the directory "Rails.root/test/tmp/file_column/" so the files
|
||||
# copied on test startup are removed. Call this in your unit test's +teardown+
|
||||
# method.
|
||||
#
|
||||
|
@ -89,7 +89,7 @@ class Test::Unit::TestCase
|
|||
# # ...
|
||||
# end
|
||||
def teardown_fixture_files
|
||||
FileUtils.rm_rf File.join(RAILS_ROOT, "test", "tmp", "file_column")
|
||||
FileUtils.rm_rf File.join(Rails.root, "test", "tmp", "file_column")
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -118,7 +118,7 @@ end
|
|||
# If we are running in the "test" environment, we overwrite the default
|
||||
# settings for FileColumn so that files are not uploaded into "/public/"
|
||||
# in tests but rather into the directory "/test/tmp/file_column".
|
||||
if RAILS_ENV == "test"
|
||||
if Rails.env == "test"
|
||||
FileColumn::ClassMethods::DEFAULT_OPTIONS[:root_path] =
|
||||
File.join(RAILS_ROOT, "test", "tmp", "file_column")
|
||||
File.join(Rails.root, "test", "tmp", "file_column")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue