Rails 3 asset pipeline paths are incorrect
I inherited a Rails3 app, and I don't have as much experience with this
version. This output is incorrect, because the image file doesn't exist in
that dir:
1.9.2p318 :006 > helper.image_tag('company_layout/red_exclam.png')
=> "<img alt=\"Red_exclam\"
src=\"/images/company_layout/red_exclam-5506fff2510ccc08ef74036ab2eca666.png\"
/>"
This output is correct, but I don't want to rewrite every single image_tag
to have to refer to yet another function (plus it breaks a lot of our
gems):
1.9.2p318 :005 >
helper.image_tag(helper.asset_path('company_layout/red_exclam.png'))
=> "<img alt=\"Red_exclam\"
src=\"/assets/company_layout/red_exclam-5506fff2510ccc08ef74036ab2eca666.png\"
/>"
So the red_exclam DOES EXIST in the assets directory, but image_tag keeps
trying to link it in the images directory, which is wrong. HELP!
Extra:
lines from production.rb:
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
lines in application.rb:
# Enable the asset pipeline
config.assets.enabled = true
config.assets.precompile += (Dir[Rails.root +
'app/assets/javascripts/*.js'] + Dir[Rails.root +
'app/assets/stylesheets/*.css']).collect{|path| File.basename(path)}
No comments:
Post a Comment