5

I've been in a battle w/ Rails 4 to try and make it pick up my assets and create the correct links. Generally, a combination of server restarts and hard refreshes will get the url's to come through correctly, but not always. tmp:clear and assetpipeline:clobber aren't working for me either.

The issue in question is with the image_path method. I'm current in a custom Form object, so I've done this:

class WalletForm
  include ActionView::Helpers::AssetUrlHelper

  def give_me_path
    image_path("logo.jpg")
  end
end

image_path is giving me "images/logo.jpg" in development and test mode. This ought to be "assets/logo.jpg". I've noticed in the past that when rails can't find the image, it will use images/logo.jpg, instead of assets. I'm guessing that this is in case you've put it in your public/images folder outside of the pipeline. But the file does exist in app/assets/images, and is in the right place. (I've copied and pasted the filename, I've tried renaming the file as well. I've restarted the web server, restarted pow) I even precompiled the assets with RAILS_ENV=test to try and verified that my logo was picked up by the pipeline, assuming

I'm not sure what else to look into. Any suggestions?

phoet
  • 18,688
  • 4
  • 46
  • 74
Jeff D
  • 2,164
  • 2
  • 24
  • 39

0 Answers0