Workaround for the deprecated static_root
This commit is contained in:
parent
88ee68de5d
commit
fe4edff7d4
@ -61,13 +61,11 @@ class Rails::Railtie::Configuration
|
|||||||
# Force the asset into the cache so find_asset will find it.
|
# Force the asset into the cache so find_asset will find it.
|
||||||
cached_assets = Rails.application.assets.instance_variable_get("@assets")
|
cached_assets = Rails.application.assets.instance_variable_get("@assets")
|
||||||
cached_assets[logical_path] = cached_assets[filename] = asset
|
cached_assets[logical_path] = cached_assets[filename] = asset
|
||||||
if File.directory?(Rails.application.assets.static_root)
|
|
||||||
# Copy the asset into the static root so the browsers will find it.
|
target = Pathname.new(File.join(Rails.public_path, Rails.application.config.assets.prefix))
|
||||||
asset_attributes = Rails.application.assets.attributes_for(logical_path)
|
asset = Rails.application.assets.find_asset(logical_path)
|
||||||
digest_path = asset_attributes.path_with_fingerprint(asset.digest)
|
filename = target.join(asset.digest_path)
|
||||||
static_path = Rails.application.assets.static_root.join(digest_path)
|
asset.write_to(filename)
|
||||||
asset.write_to(static_path)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
data
|
data
|
||||||
|
Loading…
Reference in New Issue
Block a user