Josh
2011-Sep-02 19:22 UTC
can''t compile assets on prod due to asset_host config && SSL requirement
My production asset_host config looks like this: config.action_controller.asset_host = Proc.new { |source, request| if request.ssl? "#{request.protocol}#{request.host_with_port}" else "#{request.protocol}assets#{(source.length % 4) + 1}.example.com" end } ...which is more or less straight from the docs: http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html When I go to assets:precompile, I get this: $ RAILS_ENV=production bundle exec rake assets:precompile rake aborted! This asset host cannot be computed without a request in scope. Remove the second argument to your asset_host Proc if you do not need the request. ....except that I can''t really remove the 2nd arg because I need to know if the request is ssl or not. That said, I understand that a request isn''t present during the rake task to generate the assets.... So how do I get out of this catch 22? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Josh
2011-Sep-06 18:03 UTC
Re: can''t compile assets on prod due to asset_host config && SSL requirement
bump On Sep 2, 3:22 pm, Josh <josh.m.sha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> My production asset_host config looks like this: > > config.action_controller.asset_host = Proc.new { |source, request| > if request.ssl? > "#{request.protocol}#{request.host_with_port}" > else > "#{request.protocol}assets#{(source.length % 4) + > 1}.example.com" > end > } > > ...which is more or less straight from the docs:http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.... > > When I go to assets:precompile, I get this: > > $ RAILS_ENV=production bundle exec rake assets:precompile > rake aborted! > This asset host cannot be computed without a request in scope. Remove > the second argument to your asset_host Proc if you do not need the > request. > > ....except that I can''t really remove the 2nd arg because I need to > know if the request is ssl or not. That said, I understand that a > request isn''t present during the rake task to generate the assets.... > > So how do I get out of this catch 22?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.