Skip to content

Bootstrap version is not configured (Runtime Error) #14

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jroof88 opened this issue Aug 17, 2016 · 6 comments
Closed

Bootstrap version is not configured (Runtime Error) #14

jroof88 opened this issue Aug 17, 2016 · 6 comments

Comments

@jroof88
Copy link

jroof88 commented Aug 17, 2016

Hello,

I am new to Rails and Gems so this may have an easy answer but when I follow the instructions to use this gem. I have this in my gemfile:

gem 'rails_bootstrap_navbar'

And then when try to run the server I get the error:

/usr/local/lib/ruby/gems/2.3.0/gems/bootstrap-navbar-2.3.0/lib/bootstrap-navbar/helpers.rb:9:in included: Bootstrap version is not configured. (RuntimeError)

I tried configuring the Bootstrap version using the instructions from bootstrap-navbar but still no luck. Any help would be greatly appreciated!

Thanks!

@toadkicker
Copy link

toadkicker commented Aug 18, 2016

Do you have two navbar gems loading? What's in your Gemfile.lock?

@manuelmeurer
Copy link
Member

Hey @jroof88,

Thanks for mentioning this! It wasn't explained properly in the readme. You have two options:

  • if you're using the bootstrap-sass gem, simply include it in your Gemfile before rails_bootstrap_navbar, then the Bootstrap version will be set automatically.
  • if you're not using bootstrap-sass, add an initializer and set the Bootstrap version there:
# config/initializers/rails-bootstrap-navbar.rb

BootstrapNavbar.configure do |config|
  config.bootstrap_version = '4.0.0'
end

@jroof88
Copy link
Author

jroof88 commented Aug 18, 2016

Thanks @manuelmeurer! Works great now!

@jroof88
Copy link
Author

jroof88 commented Aug 18, 2016

@manuelmeurer If I am using bootstrap 4.0.0 and following the wiki for Boostrap 3.x should it work the same?

@manuelmeurer
Copy link
Member

No, not really. The navbar was simplified a lot in Bootstrap 4.

This should work:

= navbar container: true do
  = navbar_group do
    = navbar_item 'Item 1', '/item-1'
    = navbar_item 'Item 2', '/item-2'
  = navbar_collapse toggleable: true do
    = navbar_group do
      = navbar_item 'Item 3', '/item-3'
      = navbar_item 'Item 4', '/item-4'

Check the source for all available options to the methods. I'll add full examples to the wiki page soon... 😄

@jroof88
Copy link
Author

jroof88 commented Aug 19, 2016

Thanks got it all figured. Great gem!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants