Closed pcmantz closed 12 years ago
Awesome! I knew there was this kind of problem somewhere... it has been fixed in cantango-permits which has much cleaner design and better specs but sadly hasnt been finished yet.
Thanks a lot! Feel free to add more patches that you see fit ;)
Simple example:
class Registry
def registered
@registered ||= []
end
def go
registered += []
end
end
Registry.new.go # => NoMethodError: undefined method '+' for nil:NilClass
This pull request over 90% consists of such code. Use self.registered += ...
if attr_writer :registered
defined.
I'm sorry, I have no time to patch and work on CanTango at this time. Feel free to tweak and improve it as you see fit. Thanks!
I was trying to figure out why @rules in the class CanCan::Abilility was in a list-of-lists; it turns out it was because engine_rules is appended instead of being concatenated in lib/cantango/ability/engine_helpers.rb:7.
I have not had the time to set up a testing environment to check this, but I suspect the elementary nature of the changes should speak for themselves.
I have not had a chance to look at cantango-permits and cantango-roles, do those modules have similar issues?