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?

4

1 回答 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.

于 2013-05-24T14:30:35.603 回答