Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 628 Bytes

Mongoid.md

File metadata and controls

17 lines (12 loc) · 628 Bytes

** Attention: Supported only on cancancan < 2.0! **

CanCanCan supports [[Mongoid|http://mongoid.org]]. All you have to do is mention mongoid before cancan in your Gemfile so it is required first.

gem "mongoid"
gem "cancan"

That is it, you can now call accessible_by on any Mongoid document (which is done automatically in the index action). You can also use the query syntax that Mongoid provides when defining the abilities.

# in Ability
can :read, Article, :priority.lt => 5

This is all done through a [[Model Adapter]]. See that page for more information and how you can add your own.