Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
averissimo opened this issue Feb 27, 2014 · 12 comments
Closed

Comments

@averissimo
Copy link

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
Copy link
Collaborator

andi commented Feb 27, 2014

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
.

@averissimo
Copy link
Author

@andi
Copy link
Collaborator

andi commented Feb 27, 2014

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
.

@averissimo
Copy link
Author

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
Copy link
Collaborator

andi commented Feb 27, 2014

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
.

@averissimo
Copy link
Author

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
Copy link
Collaborator

andi commented Feb 27, 2014

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
.

@averissimo
Copy link
Author

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

@simonc
Copy link
Contributor

simonc commented Feb 28, 2014

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

@averissimo
Copy link
Author

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
Copy link
Collaborator

andi commented Mar 2, 2014

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
Copy link

xskif commented May 21, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants