undefined local variable or method `render_navigation'

40 views
Skip to first unread message

Alan Gallagher

unread,
Feb 9, 2015, 5:54:08 PM2/9/15
to simple-n...@googlegroups.com
I downloaded the sample app to a different directory, it runs fine with no problems.  So its not a Ruby version or OS environment problem.

I have installed the simple-navigation gem with gem install simple-navigation in my application directory.
- ran bundle install where it installed correctly  results ->      "Using simple-navigation 3.14.0"

- included the gem in my gemfile  ->       gem "simple-navigation

- bundle show results ->   Using simple-navigation 3.14.0

My navigation.rb file is in the /config directory, here it is:

SimpleNavigation::Configuration.run do |navigation|
  navigation.autogenerate_item_ids = false
  navigation.items do |primary|
   primary.item :key_1, 'name', url, options
   primary.item :key_2, 'name', url, options do |sub_nav|
     sub_nav.item :key_2_1, 'name', url, options
    end
    primary.item :key_3, 'Admin', url, class: 'special', if: -> { current_user.admin? }
    primary.item :key_4, 'Account', url, unless: -> { logged_in? }
  end
end

The app runs fine until I insert this line in my home page:
 <%= render_navigation(:expand_all => true) %>

It returns this error message:   Line 5 is where I inserted the above line.


Showing s:/Apps/vsi/app/views/static_pages/home.html.erb where line #5 raised:undefined local variable or method `url' for #<#<Class:0x0000000b1936c8>:0x0000000af0d318>

I have researched everything I can find but am unable to remedy the problem.   Does anyone have any ideas.   I get confused on where I can use local and constants.  Do I need to define the variable in a controller?

I have gone over the support at    https://github.com/codeplant/simple-navigation with no help.

Andi Schacke

unread,
Feb 10, 2015, 2:33:05 AM2/10/15
to simple-n...@googlegroups.com
In your config file your refer to variable url, which is not defined anywere. You have to replace url with a proper url, either generated by a url_helper or a string...

Cheers
Andi

--
You received this message because you are subscribed to the Google Groups "simple-navigation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-navigat...@googlegroups.com.
To post to this group, send email to simple-n...@googlegroups.com.
Visit this group at http://groups.google.com/group/simple-navigation.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages