2

So, I'm using twitter-bootstrap-rails and this gem has a nav_bar helper method that is being loaded automatically. But if I want to use this helper method method in a namespaced view I get the error message undefined method nav_bar:

# views/admin/shared/_menu.html.erb
<%= nav_bar fixed: :top, brand: 'AdminArea', responsive: true do %>
  <%= menu_group do %>
    <%= menu_item 'Articles', admin_articles_url %>
  <% end %>
<% end %>

So I guess, since the view is being rendered in a namespaced controller the helper method is not being recognized since the helper method is in the "regular" application namespace? How do I fix this?

1
  • Instead of using helper methods, isn't it easier to just follow the Bootstrap documentation and apply the styles yourself? There is no need for a gem to do this, I believe.
    – amb110395
    May 20, 2013 at 13:38

1 Answer 1

2

I had the same problem until I used the latest gem directly from git. Put the following in your Gemfile:

gem "twitter-bootstrap-rails", :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'

Solves the problem for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.