Applied patch from pull request ryanb/cancan#966