Question

I've been building a site using Ruby on Rails and Bootstrap. For some reason the navbar on top of the page appears collapsed and is not showing the button. It looks something like a gray button with a "Brand" link next to it and inside of the button instead of showing the toggle icon is says "Toggle navigation".

This is the navbar code (which is the bootstrap default navbar code):

<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Link</a></li>
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
            <li class="divider"></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
      <form class="navbar-form navbar-left" role="search">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">Submit</button>
      </form>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>
Was it helpful?

Solution

Copying the OP's answer which they posted in the question, rather than as an answer. If the OP comes back and adds this as their own answer, I'll remove this one.

I finally solved it by unninstalling all previous versiones of bootstrap and reinstalling it following the instructions on their web. So I pasted the css/js links into my head:

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

I copied bootstap.js and bootstap.min.js into my assets/js and I erased the css flies from my assets/stylesheets.

Finally I copied //= require bootstrap.min into assest/js/applications.js (after turbolinks and before tree) and I erased the *= require bootstrap.min from assets/stylesheets/applications.css.

That did the job.

(I did install Bootstrap too using Bower but I think the issue got solved when I linked my stylesheets correctly).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top