Rails 5 assets return 404 in development -
i know question asked lot, i'm losing mind here. started building app using rails 5. deployed aws eb , set env development. assets aren't loading. getting 404. implemented sprockets , require 'rails/all'
in application.rb file running rake assets:precompile
. tried config.asset
configurations in development.rb:
config.assets_compile config.public_file_server.enabled config.assets.digest config.assets.enabled
my nginx error log full of following each of assets. path wrong. didn't put assets in /var/app/current/public
, put them in /var/app/current/app/assets
. @ point, had fetching there (don't remember how) still didn't work:
2017/07/28 01:16:15 [error] 2994#0: *1387 open() "/var/app/current/public/assets/merck-logo.png" failed (2: no such file or directory), client: 76.218.103.88, server: _, request: "get /assets/merck-logo.png http/1.1", host: "merckcoupons-dev1.dv3ww3wmii.us-west-1.elasticbeanstalk.com", referrer: "http://merckcoupons-dev1.dv3ww3wmii.us-west-1.elasticbeanstalk.com/circular"
the crazy thing did app not long ago , have open guide. i've been googling hours , can't figure out. appreciated!
when referencing images using image_tag
helper include filename , no path. rails use file in app/assets/images
in development environment , use public/assets/image_name_finger_print.ext
in other environments (after pre-compilation)
see: http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets
for example:
good: <%= image_tag 'rails.png' %>
bad: <%= image_tag '/assets/rails.png' %>
Comments
Post a Comment