Rails: Bootstrap dropdown menu not working

后端 未结 6 1476
逝去的感伤
逝去的感伤 2021-01-24 14:18

I am quite new to Rails and have been following the tutorial by Michael Hartl. Everything has been going along really well until I got to the drop down menu, which was wasn\'t

6条回答
  •  感动是毒
    2021-01-24 15:05

    The problem is bootstrap's javascript. Sometimes is loaded two times.

    This works to me:

    application.js:

    //= require jquery
    //= require jquery_ujs
    //= require turbolinks
    //= require bootstrap
    

    application.scss: Don't use //= require in scss files

    @import "*";
    @import "bootstrap";
    @import "font-awesome";
    

    Then:

    rake assets:clean
    rake assets:precompile 
    

    OR

    Put bootstrap.js in assets/javascripts folder and put //= require_tree . line

提交回复
热议问题