A ruby gem for creating navigations (with multiple levels) for your Rails 2, Rails 3, Rails 4, Sinatra or Padrino applications. Render your navigation as html list, link list or breadcrumbs.
Andi Schacke's Developer Blog: simple-navigation Version 3
I have been using Rails 4.2.0 beta and using SImple navigation
i have added
gem 'simple-navigation'
in my gemfile
and did
bundle install
And added a file under config/initializers/navigation.rb
which has
require 'simple-navigation'
SimpleNavigation.config_file_path = File.join(Rails.root, 'config', 'navigations')
And i have a file article_navigation.rb
which has
SimpleNavigation::Configuration.run do |navigation|
navigation.renderer = SimpleNavigation::Renderer::List
navigation.autogenerate_item_ids = false
navigation.selected_class = 'active'
navigation.items do |primary|
primary.item :new_article, 'Post an Article', "#"
primary.dom_class = 'nav' end end
In my View file articles/index.html.slim
I have tried to use
= render_navigation(context: :article)
which throws
NoMethodError (undefined method `render_navigation' for
<#:0x007f9cdc95ab98>):
Help me in fixing this.
Source: (StackOverflow)