0

I've downloaded the project files from the Treehouse Rails Developer course. Rails Development adventure, Stage 4 : Using AJAX. I managed to get the app working but my bootstrap styling does not display.

The bootstrap files are all in their respective folders.

Here's some code from my application.css :

*= require_self
*= require_tree

body {
padding-top: 40px;
}

.alert {
margin-top: 10px;
}

My application.html.erb does contain the stylesheet link tag :

<%= stylesheet_link_tag "application", :media => "all" %>

I'm running rails v 3.2.6 on OSX Mavericks

Thanks ahead of time for the assistance

2 Answers 2

2

Your application.css file should like this:

*= require_self
*= require_tree .

body {
padding-top: 40px;
}

.alert {
margin-top: 10px;
}

The period is important - it means grab all of the stylesheets in the current directory.

Sign up to request clarification or add additional context in comments.

2 Comments

Went ahead and changed that with no luck still. When I'm inspecting the page, I noticed that application.css and application.js are linked but I don't see bootstrap.css or any other css files in my stylesheets folder
Hmm... maybe try using a gem to install the files for you? Check out this Railscast by Ryan Bates. Add the gem 'twitter-bootstrap-rails' to your Gemfile (don't forget to bundle install), and run the command rails g bootstrap:install. From there you can compare what you have against what the gem installs for you. Also don't forget to try restarting your server when you change up your assets.
1

I've figured it out :

  1. set config.assets.initialize_on_precompile = true in application.rb
  2. flush the asset pipeline cache by running rake tmp:cache:clear

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.