Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CanCanCan 3.2 requires ActiveRecord adapter #671

Closed
starpeak opened this issue Dec 13, 2020 · 3 comments · Fixed by #674
Closed

CanCanCan 3.2 requires ActiveRecord adapter #671

starpeak opened this issue Dec 13, 2020 · 3 comments · Fixed by #674

Comments

@starpeak
Copy link

When I update CanCanCan on a Rails project, that does use Mongoid instead of AR, I get the following error on startup:

.../gems/ruby-2.6.6/gems/cancancan-3.2.0/lib/cancan/config.rb:6:in `valid_accessible_by_strategies': uninitialized constant CanCan::ModelAdapters::ActiveRecordAdapter (NameError)

It does not matter if I include cancancan-mongoid or not. In my optinion it should check if AR is used on the config valid_accessible_by_strategies like it does on the loading of files in cancan.rb

@coorasse
Copy link
Member

@ghiculescu caused by

strategies << :subquery unless CanCan::ModelAdapters::ActiveRecordAdapter.version_lower?('5.0.0')
, right? Would you mind offering a patch for the mongoid people? :) I think we don't need these configurations for Mongoid.

@ghiculescu
Copy link
Contributor

ghiculescu commented Dec 14, 2020

Sorry about that @starpeak!

Can you please check that #674 fixes things?

@ghiculescu
Copy link
Contributor

@coorasse should we aim for a 3.2.1 release with #673 + #674 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants