html - CSS not loading after refresh in Rails -
i'm new rails, have created app in user has profile , can edited edit profile option.
in controller have,
profilescontroller
in views have,
index.html.erb edit.html.erb
it works fine index page, edit page it's cool first load , after refreshing it, css files not loading.
url looks http://localhost:3000/profiles/25/edit
everything works right index page no matter how many refreshes, it's disappointing edit page.i have inspected elements in browser, says get http://localhost:3000/profiles/25/assets/bootstrap.min.css [http/1.1 404 not found 650ms]
i.e searches files in localhost:3000/profiles/25/assets/
doesn't exists instead of searching in localhost:3000/assets/
edit :
structure:
app/assets/stylesheets application.css bootstrap.min.css style.css
in application.html.erb , link application.css as,
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
and other css files as
<link href="assets/style.css" rel="stylesheet"> <link href="assets/bootstrap.min.css" rel="stylesheet">
am correct structure , linking? if not place , use external css files.
please help!! in advance.
the default rails asset pipeline assumes want all stylesheets apply every page. found awkward @ first realized fits rails' ethos of "don't repeat yourself" , creating sensible defaults save developer time. of time, styles you're writing won't mind being present on pages.
from i'm hearing, 1 page in app loads fine 1 fails because css asset isn't found. suggests me you're doing apart rails' asset pipeline, , consequently bootstrap.css isn't getting loaded incorrectly. can search app/assets , app/views directories mentions of bootstrap
, , let me know find?
ideally place bootstrap styles should declared in app/assets/stylesheets/application.css
"manifest file" looks this:
/* * sprockets manifest. see https://github.com/sstephenson/sprockets * compiles css old site design (pre-wpboom redesign). * *= require bootstrap *= require jquery-ui *= require_tree . */
Comments
Post a Comment