Search code examples
ruby-on-railsrubybootstrap-5

Bootstrap not correctly working with Rails


Hello everyone

I start a new rails app with this starter template and when i add a simple navbar from bootstrap.

its look like this enter image description here

The principal problem is that JS is not working, the dropdown menus doesn't work and the searchnar is not in his correct position.

I'm using rails 7.0.4 and ruby 3.1.2p20 and

It should be like this enter image description here


Solution

  • Ok, thast's a bit shame but all the problem was that i was using the wrong version of bootstrap template. I'm not working in this project anymore so don't have access to the versions that makes me write this help request but i remember what was causing the "problem".

    Let's supose that we start a new application:

    rails new YOUR_APP_NAME --css=bootstrap
    

    Rails will generate a .package.json File where you can see the bootsrap version enter image description here

    My problem was that i went to bootstrap page with the wrong version and if you do this some styles and js features that comes with the bootstrap library won't work correctly.

    Always remember to check what version do you have in your package.json and search this version in bootsrap page.