Awesome news for Ruby on Rails fans! CanCanCan 3.0 is here! RoR authorization framework got updated and we can’t be silent about it. It has been almost two years since the release of version 2.0, so it will have some new exciting features that we will share with you in this post.
First of all, it is a major version, so be ready for some really important changes:
- All kind of rules like
can :dashboardare not going to be accepted anymore and will raise an exception. They will be rethought in terms of
can :action, subject.
can :read, :dashboard.
- All necessary
eager_loadneed to be explicitly written.
- The uniqueness of the results is guaranteed by using the
distinctclause in the final query. Adding a custom
selectmay be necessary in such cases.
- When merging different Ability files, the aliases are now got merged. This might cause some incompatibility issues.
- You can now use symbols when defining your rules over enum attributes.
- CanCanCan 3.0 is able to recognize rules that are not needed and change the last query.
- Compressing rules means unnecessary JOIN and WHERE conditions will be skipped.
Do you feel that spirit of changes? We do. And we recommend you to check this material to explore all changes in more details.
And speaking of changes, did you check our last Monthly trending Ruby on Rails repositories? There you will explore a great serialization solution, Ruby autoformatter, GitLab CE Mirror, toolkit for file attachments, collaborative knowledge-exchange platform, Object Oriented DOM Tree and many other awesome repositories.
And we have Telegram! Join if you feel you can handle all the amazing information we’re eager to share!