Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix image_tag_helper
  • Loading branch information
takafumir committed Feb 8, 2017
1 parent 84afdaa commit 4060cfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/rails_amp/version.rb
@@ -1,3 +1,3 @@
module RailsAmp
VERSION = '0.1.8'
VERSION = '0.1.9'
end
5 changes: 3 additions & 2 deletions lib/rails_amp/view_helpers/image_tag_helper.rb
Expand Up @@ -45,8 +45,9 @@ def compute_image_size(source)
source_for_fastimage = source
unless source =~ ::ActionView::Helpers::AssetUrlHelper::URI_REGEXP
# find_asset is a Sprockets method
source_for_fastimage = Rails.application.assets.find_asset(source).try(:pathname).to_s.presence ||
File.join(Rails.public_path, source)
asset_env = Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application)
source_for_fastimage = asset_env.find_asset(source).try(:pathname).to_s.presence ||
File.join(Rails.public_path, source)
end
FastImage.size(source_for_fastimage) || [300, 300]
end
Expand Down

0 comments on commit 4060cfe

Please sign in to comment.