forked from koppen/hassle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix cache busting on Hassle stylesheets.
- Loading branch information
1 parent
b2ce7d0
commit 74f9a95
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
require File.dirname(__FILE__) + '/hassle/hassle' | ||
require File.dirname(__FILE__) + '/hassle/railtie' | ||
require File.dirname(__FILE__) + '/hassle/action_view' | ||
require File.dirname(__FILE__) + '/hassle/railtie' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# fix cache busting for Hassle stylesheets | ||
# try the original path ("public/") and if not found, try "tmp/". | ||
|
||
require 'action_view/helpers/asset_tag_helper' | ||
|
||
module ActionView::Helpers::AssetTagHelper | ||
private | ||
def rails_asset_id_with_tmp_path(source) | ||
asset_id = rails_asset_id_without_tmp_path source | ||
if asset_id.blank? | ||
org_dir = config.assets_dir | ||
begin | ||
config.assets_dir = Rails.root + 'tmp/hassle' | ||
asset_id = rails_asset_id_without_tmp_path source | ||
ensure | ||
config.assets_dir = org_dir | ||
end | ||
end | ||
asset_id | ||
end | ||
alias_method_chain :rails_asset_id, :tmp_path | ||
end |
74f9a95
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
I'd really like to use your fork since it seems to fix the cache-busting problem, but this monkey patch is causing my app to blow up (see below). Seems like some kind of load-order thing. I reverted to your previous commit, and took this monkey-patch and put it in a Rails initializer, and it worked fine.
74f9a95
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Mike,
Thanks for letting me know about this issue. I have reproduced it in a clean Rails 3.0.5 app and have added a couple additional
require
s in 2b17153 to fix the issue.Jason
74f9a95
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - works like a charm.