Migration Guide
From 2.x to 3.x
Breaking changes
Defining abilities without a subject is not allowed anymore. For example,
can :dashboardis not going to be accepted anymore and will raise an exception. All these kind of rules need to be rethought in terms ofcan action, subject.can :read, :dashboardfor example.Eager loading is not automatic. If you relied on CanCanCan to avoid N+1 queries, this will not be the case anymore. From now on, all necessary
includes,preloadoreager_loadneed to be explicitly written. We strongly suggest to havebulletgem installed to identify your possible N+1 issues.Use of distinct. Uniqueness of the results is guaranteed by using the
distinctclause in the final query. This may cause issues with some existing queries when using clauses likegroup byororderon associations. Adding a customselectmay be necessary in these cases.aliases are now merged. When using the method to merge different Ability files, the aliases are now also merged. This might cause some incompatibility issues.
