Friday, 10 October 2014

CanCan ActiveModel::ForbiddenAttributesError with Rails 4

1) Replace gem in gem file
Use gem 'cancancan', '~> 1.9', in place of gem 'cancan'

2) In your controller use like this:
load_and_authorize_resource param_method: :my_sanitizer 

my_sanitizer is a example. It is your controller permit params method, similar like:

def my_sanitizer
    params.require(:article).permit(:name)
 end

No comments:

Post a comment