Problem with Cancan

180 views
Skip to first unread message

JB

unread,
Dec 3, 2011, 6:20:22 PM12/3/11
to ActiveScaffold : Ruby on Rails plugin
I'm getting this weird error in production and not in development:

CanCan::AuthorizationNotPerformed in ContactsController#index

This action failed the check_authorization because it does not
authorize_resource. Add skip_authorization_check to bypass this check.

I have plenty of other models/controllers authorized by Cancan that
work fine. The only one I seem to have any problems with is this one.

I've even reduced my ability.rb file to this:

class Ability
include CanCan::Ability

def initialize(user)
can :manage, :all
end
end

Any ideas on what might be causing this or where I should look?

clyfe

unread,
Dec 6, 2011, 6:03:16 AM12/6/11
to actives...@googlegroups.com
https://github.com/vhochstein/active_scaffold/wiki/CanCan-bridge

Maybe add  skip_authorization_check :only => 'index'

JB

unread,
Dec 6, 2011, 10:10:40 AM12/6/11
to ActiveScaffold : Ruby on Rails plugin
Sure, that will solve the problem. But why would it work fine and
authorize the index view in development but not in production? And why
only this one model when I have several other models that work fine?
I'm starting to think this is a bug in the CanCan-bridge, in CanCan
itself, or in the RoR framework somewhere. It just doesn't make sense.
Reply all
Reply to author
Forward
0 new messages