kristianmandrup / cancan-permits

Role specific Permits for use with CanCan permission system
MIT License
21 stars 1 forks source link

NoMethodError (You have a nil object ... The error occurred while evaluating nil.inject) #6

Open netizer opened 13 years ago

netizer commented 13 years ago

This error is raised when I create a new rails 3 app, and use cream full_config generator. It's about this line: lib/cancan-permits/permits/ability.rb:26 but the issue seams to be somewhere else.

I think, that there should be "Cream::Role.available" instead of "Cream.available_roles" in lib/cancan-permits/permits/roles.rb

The workaround is to add "Cream.available_roles = ..." next to "config.roles=" in generated cream.rb initializer

kristianmandrup commented 13 years ago

Yeah, the whole available roles stuff needs to be cleaned up and simplified! I hope to get time to work on a cream 2 soon.

Unfortunately I have been stuck with an error of this type:

ruby_code case not handled: Syck::PrivateType

Ever since upgrading to Rubygems 1.5+ no matter if I use ruby 1.9.2 or 1.9.3-head. Any ideas how to resolve this?

netizer commented 13 years ago

Thanks for quick response :)

Yes, I think I had this error too. I moved to rubygems 1.5.2 (I have ruby 1.9.2p136), and it works fine now.

BTW. Will cream2 be still integration of Cancan, Devise, and Roles, or a complete rewrite of those too?

kristianmandrup commented 13 years ago
$ gem install rubygems-update
Successfully installed rubygems-update-1.5.2
1 gem installed
Installing ri documentation for rubygems-update-1.5.2...
Building YARD (yri) index for rubygems-update-1.5.2...
Installing RDoc documentation for rubygems-update-1.5.2...
kristian-mandrups-macbook-pro:cream kristianconsult$ update_rubygems
:30: stack level too deep (SystemStackError)
kristian-mandrups-macbook-pro:cream kristianconsult$ gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.5.2
Updating RubyGems to 1.5.2
Installing RubyGems 1.5.2
:30: stack level too deep (SystemStackError)
kristian-mandrups-macbook-pro:cream kristianconsult$ rake install
/Users/kristianconsult/.rvm/gems/ruby-1.9.3-head/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
(in /Users/kristianconsult/Development/Languages/Ruby/Apps/Gems/cream)
WARNING:  no rubyforge_project specified
  Successfully built RubyGem
  Name: cream
  Version: 0.8.9.2
  File: cream-0.8.9.2.gem
Executing "ruby -S gem install ./pkg/cream-0.8.9.2.gem":
ruby -S gem install ./pkg/cream-0.8.9.2.gem
ERROR:  While executing gem ... (Gem::Exception)
    ruby_code case not handled: Syck::PrivateType
rake aborted!
Command failed with status (1): [ruby -S gem install ./pkg/cream-0.8.9.2.ge...]

I think I have to remove Rubygems alltogether somehow and go from there. I've also tried removing ruby 1.9.2 and reinstall it via rvm.

Cream 2, will mostly be a cleaner version of Cream using what I've learned in the proces (especially regarding user-types vs. roles). And making it more extensible with plugins for further customization solutions perhaps.

netizer commented 13 years ago

For me it looks like something is wrong with your environment (I don't know, maybe it's conflict between two versions of rubygems). I'm sure I have never seen such error: :30: stack level too deep (SystemStackError)

I use rvm. I think it simplifies things a lot, and makes your environment clean (I would create new gemset for ruby 1.9.2 under rvm and update rubygems with "rubygems-update" gem)

kristianmandrup commented 13 years ago

Thanks ;) I have been using RVM for at least the past 6 months if not longer. I think by now it needs to be reinstalled as something is messed up. I will try that. Hopefully then I can continue on Cream development...