bootstrap-ruby / rails-bootstrap-navbar

Easily generate a Bootstrap navbar in your Rails app
http://bootstrap-ruby.github.io/rails-bootstrap-navbar
MIT License
60 stars 13 forks source link

Bootstrap version is not configured (Runtime Error) #14

Closed jroof88 closed 8 years ago

jroof88 commented 8 years ago

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 commented 8 years ago

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

manuelmeurer commented 8 years ago

Hey @jroof88,

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

# config/initializers/rails-bootstrap-navbar.rb

BootstrapNavbar.configure do |config|
  config.bootstrap_version = '4.0.0'
end
jroof88 commented 8 years ago

Thanks @manuelmeurer! Works great now!

jroof88 commented 8 years ago

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

manuelmeurer commented 8 years ago

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 commented 8 years ago

Thanks got it all figured. Great gem!