css - Why isn't my images and stylesheets not working in RoR app? -


sorry dumb question, spent 2 days trying , nothing solved issue. problem need "simply edit file html , app work". sounds easy, far it's impossible me!

i have in application.html.erb:

<%= stylesheet_link_tag "core.css", :media => "all" %> <%= stylesheet_link_tag "/turnkey/style.css" %> 

just in case, i followed question solutions, did nothing me. core.css works fine, /turnkey/style.css 404.

my style.css file indeed there, can see screen capture (sorry, can't add images): enter link description here

i tried clearing cache, tried restarting server nothing. tried placing style.css file in assets/stylesheets , nothing

one thing have noticed original core.css shows up. if replace contents of style.css , displays content of original core.css thought cache issue, used solution @ http://blog.serendeputy.com/posts/how-to-prevent-browsers-from-caching-a-page-in-rails/

..in application_controller.rb..   before_filter :set_cache_buster   def set_cache_buster     response.headers["cache-control"] = "no-cache, no-store, max-age=0, must-revalidate"     response.headers["pragma"] = "no-cache"     response.headers["expires"] = "fri, 01 jan 1990 00:00:00 gmt"   end 

but still couldn't fix it.

additionally, images @ app/assets/images show 404 well, though i'm uploading them same folder original images are. old images ok, new images don't show, if never uploaded

in short, i'm totally lost. sorry stupid question, don't know do

for css take out / beginning of path:

<%= stylesheet_link_tag "turnkey/style.css" %>

this way rails prepends assets/stylesheets path automatically. if add / in beginning, rails thinks providing full path.

similarly images in assets/images folder, need use this:

<%= image_tag "image_filename" %>

replace image_filename full name of image file (including ext in cases).

for more in-depth details, read this: http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -