views:

236

answers:

2

What happened to asset_host in rails 3? Earlier I can put following code into development.rb and get all assets not present on development:

ActionController::Base.asset_host = proc do |source, request|
  unless File.exist?(File.join(RAILS_ROOT, 'public', source.sub(/\?\d+$/, '')))
    'http://example.com'
  end
end

But in rails 3 there is no such method and google does not help me.

+1  A: 

The asset_host config information goes into you environment files, which have changed format slightly:

// environments/production.rb
Infinity::Application.configure do

  config.action_controller.asset_host = "http://assets.example.com"

end

I'm not sure this will let you override in the same way as your code, though.

Toby Hede
Finally, I found info going through rails source. It allows assigning proc as it earlier version.
tig
A: 

@tig: can you please post the updated code here for the asset_host?

Alex Le
Look at Toby Hede's reply. If you need to use proc — just use it instead of string. And it is better to use comments for such questions.
tig