diff options
author | Noah Silas <noah@causes.com> | 2012-06-08 18:11:58 -0700 |
---|---|---|
committer | Noah Silas <noah@causes.com> | 2013-01-07 15:49:51 -0800 |
commit | 9bc5e6517c409d1fa71ba704bbf514afdbc0831b (patch) | |
tree | d6f70fcba50b7fde997bbc1f80a12b069fc7218c /actionpack/test/controller/webservice_test.rb | |
parent | 6b9cb71b2fa0893139a87bee2bbd5293cd8c0487 (diff) | |
download | rails-9bc5e6517c409d1fa71ba704bbf514afdbc0831b.tar.gz rails-9bc5e6517c409d1fa71ba704bbf514afdbc0831b.tar.bz2 rails-9bc5e6517c409d1fa71ba704bbf514afdbc0831b.zip |
Fix javascript_include_tag when no js runtime is available
In a production environment where the assets have been precompiled, we
don't want an assets compile step to happen on the application server at
all. To ensure this, a js runtime may not be available on the app
servers. In this environment, pages using javascript_include_tag for
assets with non-standard or chained extensions were throwing 500 errors.
For instance, `javascript_include_tag('jquery.min')` would blow up.
Sprockets was attempting to build the assets being included during the
rewrite_extension step (responsible for appending a '.js' extension to
assets being included by the basename rather than a fully qualified
name). This was happening as a step to resolve #6310, which required
checking for the presence of an asset with a non-standard extension
before appending the extension.
We can check for the presence of an asset without invoking the asset
build step by using Sprockets' resolve method, which will search for the
base file without building it (and is the method that find_asset uses
internally to get the path to the asset before attempting to build it).
When rewriting the extension on an asset, these are the steps:
- If the source does not have an extension, assume that the default
extension is desired and append it.
- If there is an extension and it doesn't match the default extension,
check to see if a file with the precise name specified exists amongst
the assets; if it is present, do not append the default extension.
(This is the step that resolves #6310).
Diffstat (limited to 'actionpack/test/controller/webservice_test.rb')
0 files changed, 0 insertions, 0 deletions