Permalink
Browse files

Clean up asset_host and asset_path.

  • Loading branch information...
1 parent cc70ac9 commit 8e6d27641cf213a13d51491cecfbfa1d3c8822fd @josevalim josevalim committed Dec 9, 2010
@@ -19,8 +19,8 @@ class Railtie < Rails::Railtie
options.stylesheets_dir ||= paths["public/stylesheets"].first
# make sure readers methods get compiled
- options.asset_path ||= nil
- options.asset_host ||= nil
+ options.asset_path ||= app.config.asset_path
+ options.asset_host ||= app.config.asset_host
ActiveSupport.on_load(:action_mailer) do
include AbstractController::UrlFor
@@ -27,8 +27,8 @@ class Railtie < Rails::Railtie
options.page_cache_directory ||= paths["public"].first
# make sure readers methods get compiled
- options.asset_path ||= nil
- options.asset_host ||= nil
+ options.asset_path ||= app.config.asset_path
+ options.asset_host ||= app.config.asset_host
ActiveSupport.on_load(:action_controller) do
include app.routes.mounted_helpers
@@ -4,12 +4,12 @@
module Rails
class Application
class Configuration < ::Rails::Engine::Configuration
- attr_accessor :allow_concurrency, :cache_classes, :cache_store,
+ attr_accessor :allow_concurrency, :asset_host, :cache_classes, :cache_store,
:encoding, :consider_all_requests_local, :dependency_loading,
- :filter_parameters, :log_level, :logger,
+ :filter_parameters, :helpers_paths, :log_level, :logger,
:preload_frameworks, :reload_plugins,
:secret_token, :serve_static_assets, :session_options,
- :time_zone, :whiny_nils, :helpers_paths
+ :time_zone, :whiny_nils
def initialize(*)
super
@@ -24,22 +24,9 @@ def initialize(*)
@session_options = {}
@time_zone = "UTC"
@middleware = app_middleware
- @asset_path = '/'
@generators = app_generators
end
- def asset_path=(value)
- action_mailer.asset_path = value if respond_to?(:action_mailer) && action_mailer
- action_controller.asset_path = value if respond_to?(:action_controller) && action_controller
- super(value)
- end
-
- def asset_host=(value)
- action_mailer.asset_host = value if action_mailer
- action_controller.asset_host = value if action_controller
- super(value)
- end
-
def compiled_asset_path
"/"
end

8 comments on commit 8e6d276

@bouchard
Contributor

Hey Jose,

This commit breaks my app with bad asset paths. Instead of:
'/javascripts/jquery.js', this now links to '/my_app_name_application/javascripts/jquery.js'.

Same with stylesheets.

Any hints on how to get this working again?

@josevalim
Member

Ugh, I could not reproduce it. Are you setting config.asset_path to something in your app?

@bouchard
Contributor

Hey Jose,

Just had a deeper look to check that it's not something I did, and I don't think it is:

  • Not setting asset_path anywhere. I am setting asset_host, as per the defaults: "assets%d.domain.com".
  • removed asset_packager plugin (https://github.com/brady8/asset_packager), as I thought that might be messing with something, but it's not. Same problem without.
  • Doublechecked that it is actually this commit, and it is.

Let me know if something comes to you, but if this hasn't blown up for you or anyone else then I'll try with a fresh app and see if I can figure out how I managed to screw it up. Thanks for your help!

@josevalim
Member

Hey Brady, I just tried to reproduce this in a new app and I could not. Could you please try and let me know?

@josevalim
Member

I got it.

@josevalim
Member

I got it. I am working on a fix.

@bouchard
Contributor

Thanks Jose, appreciate it!

@josevalim
Member

Fixed here: 1860d87

Please sign in to comment.