Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Simple Ruby on Rails Application Frontend Development Installing Twitter Bootstrap

Installing Twitter Bootstrap using maxcdn links

Hi guys,

I was wondering if it's a good thing to use maxcdn links instead of downloading bootstrap in our application.

I tried it and it seems to work but I don't know if it's the best way to do it. I edited the application.html.erb file like this :

<!DOCTYPE html>
<html>
<head>
  <title>Statusapp</title>
  <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>

Can I continue the Ruby tutorial with this ?

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

The best way to use Bootstrap in Rails applications in my opinion is through a gem:

https://github.com/seyhunak/twitter-bootstrap-rails

I never tried your method, so I'm not sure if it will work correctly.

Now this is important: this course you're doing is outdated. It uses old version of Rails, which will give you headaches unless you downgrade to Rails 3.2. It also uses an older version of Bootstrap (2.x). This means that a lot of stuff will not look the way it shows in the videos, unless you get your hands on an older version of Bootstrap as well. A lot of CSS classes got changed in the newest version compared to the one seen in the videos. Another thing to remember is that CSS now has a pseudoclass :hover, so using JavaScript for hover effects (as seen in the videos) is redundant.

Thanks for your answer,

For the moment, I just want to follow the tutorial so I'm not going to install this gem even if it seems to be a pretty good way to use bootstrap in Ruby on Rails, easier and faster to write.

I know the version is outdated but I'm pretty comfortable with CSS and the Bootstrap documentation is good so it's easy to find the actual components I think.

I will continue this way and see if I got problems ...

Thanks again !