Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clean up asset_host and asset_path.

  • Loading branch information...
commit 8e6d27641cf213a13d51491cecfbfa1d3c8822fd 1 parent cc70ac9
@josevalim josevalim authored
View
4 actionmailer/lib/action_mailer/railtie.rb
@@ -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
View
4 actionpack/lib/action_controller/railtie.rb
@@ -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
View
19 railties/lib/rails/application/configuration.rb
@@ -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

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
Owner

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

@bouchard

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
Owner

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
Owner

I got it.

@josevalim
Owner

I got it. I am working on a fix.

@bouchard

Thanks Jose, appreciate it!

@josevalim
Owner

Fixed here: 1860d87

Please sign in to comment.
Something went wrong with that request. Please try again.