codeplant/simple-navigation

v3.12.1: undefined method html_options for SimpleNavigation::ItemAdapter

averissimo opened this issue · 12 comments

When upgrading my rails 3.2.13 to v3.12.1 the error below shows in every page that renders menus

I had to revert to v.3.11.0

undefined method `html_options' for #<SimpleNavigation::ItemAdapter:0x007f2270d2bce0>

framework trace:
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/renderer/list.rb:32:in `block in list_content'
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/renderer/list.rb:31:in `map'
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/renderer/list.rb:31:in `list_content'
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/renderer/list.rb:23:in `render'
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/core/item_container.rb:106:in `render'
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/helpers.rb:92:in `render_navigation'
actionpack (3.2.13) lib/abstract_controller/helpers.rb:53:in `render_navigation'
andi commented

can you post your navigation.rb config file? Thanks.

On Thu, Feb 27, 2014 at 8:26 PM, André Veríssimo
notifications@github.comwrote:

When upgrading my rails 3.2.13 to v3.12.0 or v3.12.1 the error below shows
in every page that renders menus

undefined method `html_options' for #SimpleNavigation::ItemAdapter:0x007f2270d2bce0

framework trace:
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/renderer/list.rb:32:in block in list_content' /home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/renderer/list.rb:31:inmap'
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/renderer/list.rb:31:in list_content' /home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/renderer/list.rb:23:inrender'
/home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/core/item_container.rb:106:in render' /home/.rvm/gems/ruby-1.9.3-p484/bundler/gems/simple-navigation-db7b381693d0/lib/simple_navigation/rendering/helpers.rb:92:inrender_navigation'
actionpack (3.2.13) lib/abstract_controller/helpers.rb:53:in `render_navigation'


Reply to this email directly or view it on GitHubhttps://github.com//issues/154
.

andi commented

Can I rund that application (BGFit) myself, ie. can I reproduce the issue
when I check out the repo?

On Thu, Feb 27, 2014 at 11:03 PM, André Veríssimo
notifications@github.comwrote:

It's here:
https://github.com/averissimo/BGFit/blob/master/config/navigation.rb


Reply to this email directly or view it on GitHubhttps://github.com//issues/154#issuecomment-36297245
.

Yes, but the gem dependencies needs octave-ruby package and there are configuration files needed:

#define a database on /config/database.yml

$ cp config/model_blackbox.yml.example config/model_blackbox.yml
$ rake db:create:all
$ rake db:migrate

#change gemfile in line 75 from version v3.11.0 to v3.12.1
$ rails s
# open localhost:3000

Just tried it out and the problem is specific to v3.12.1

andi commented

so 3.12.0 works fine?

On Thu, Feb 27, 2014 at 11:45 PM, André Veríssimo
notifications@github.comwrote:

Yes, but the gem dependencies needs octave-ruby package and there are
configuration files needed:

#define a database on /config/database.yml

$ cp config/model_blackbox.yml.example config/model_blackbox.yml
$ rake db:create:all
$ rake db:migrate

#change gemfile in line 75 from version v3.11.0 to v3.12.1
$ rails s

open localhost:3000

Just tried it out and the problem is specific to v3.12.1


Reply to this email directly or view it on GitHubhttps://github.com//issues/154#issuecomment-36301332
.

Yes 3.12.0 works fine, my bad on reporting on that version! But I can confirm on a clean install of this application (bgfit) that v3.12.1 does not work (when alternating between v3.12.0 or v3.11.0 works fine). I'll try testing on a clean rails app.

By the way, you can simply remove the octave-ruby from the Gemfile and avoid having to install additional libraries.. it is not essential

Oh and thanks!! Before posting my last reply I checked out the app and tested running it from scratch.. result: found some remnants of some migrations that were raising problems :)

andi commented

Ok, thanks, I'll try to debug this over the weekend...

On Fri, Feb 28, 2014 at 12:00 AM, André Veríssimo
notifications@github.comwrote:

Yes 3.12.0 works fine, my bad on reporting on that version! But I can
confirm on a clean install of this application (bgfit) that v3.12.1 does
not work (when alternating between v3.12.0 or v3.11.0 works fine). I'll try
testing on a clean rails app.

By the way, you can simply remove the octave-ruby from the Gemfile and
avoid having to install additional libraries
.. it is not essential

Oh and thanks!! Before posting my last reply I checked out the app and
tested running it from scratch.. result: found some remnants of some
migrations that were raising problems :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/154#issuecomment-36302826
.

Ok, I think I detected the exact problem: dynamic menus

Created a new Rails app and a blank controller

    $ rails n blog
    $ cd blog
    # add simple-navigation gem to Gemfile
    $ bundle install
    $ rails g scaffold home
    $ rake db:migrate
    $ rm public/index.html
    # add default root to homes#index

Add the following code to the layout
app/views/layout/application.html.erb

<%
link_array = [
      {
        :key => :sign_up, 
        :name => '21', 
        :url => root_path
}]
%>
<%= render_navigation( :items => link_array ) %>

repo below -- access only via git.. no http viewer :):

git clone http://kdbio.inesc-id.pt/~averissimo/git/blog.git

I found the cause of the issue, I'm really sorry, I'll make a PR to fix this.

I cannot reproduce the problem anymore with master branch. With my BGFit application and test blog.

Problem seems solved :)

Thank you!

p.s. No need to be sorry, thank you for this great gem and fantastic feedback on this issue! :)

andi commented

Fix deployed in 3.12.2

On Fri, Feb 28, 2014 at 7:17 PM, André Veríssimo
notifications@github.comwrote:

Closed #154 #154.


Reply to this email directly or view it on GitHubhttps://github.com//issues/154
.

xskif commented

I have the same issue
undefined method 'html_options=' for #<SimpleNavigation

version 4.0.3

It's rises with default example:

    primary.item :key_2, 'name', '' do |sub_nav|
      # Add an item to the sub navigation (same params again)
      sub_nav.item :key_2_1, 'name', ''
    end

UPD: forget, this is because of simple-navigation-bootstrap renderer