controller level add_crumb() fails #16

Closed
sjain opened this Issue Oct 28, 2011 · 4 comments

Projects

None yet

3 participants

@sjain
Contributor
sjain commented Oct 28, 2011

With a class level add_crumb defined as follows:

class UsersController < ApplicationController
add_crumb("User List", :except => [:index]) { |instance| instance.send :users_path }
...
end

I get following in latest master:

NoMethodError: undefined method map!' for "/users":String vendor/bundle/ruby/1.8/gems/crummy-1.3/lib/crummy/action_controller.rb:24:inadd_crumb'
vendor/bundle/ruby/1.8/gems/activesupport-2.3.12/lib/active_support/callbacks.rb:182:in call' vendor/bundle/ruby/1.8/gems/activesupport-2.3.12/lib/active_support/callbacks.rb:182:inevaluate_method'
vendor/bundle/ruby/1.8/gems/activesupport-2.3.12/lib/active_support/callbacks.rb:166:in call' test/functional/users_controller_test.rb:22:in__bind_1319836051_713591'

@bhushangahire
Contributor

Hi Did you got the solution. I am also getting same error.

@bhushangahire
Contributor

I found the solution.
In ruby 1.8.7 you dont have map! method. And the line 21 is checking "if url.kind_of? Enumerable" where in it should be "if url.kind_of? Array".

@zachinglis
Owner

Array is inherited from Enumerable.

Array.new.kind_of?(Enumerable) => true

Also, in Ruby 1.8.7 you do have map method. It's seeing a String rather than the Array it should be seeing. I'll try and work on this.

@bhushangahire
Contributor

You dont have map or map! method for String class. And String also kind of Enum. So it satisfies condition and breaks the code.

@zachinglis zachinglis closed this in e50f677 Nov 4, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment