The scope needs to contain a proc in order for it to be set correctly. The docs contain the following code snippet:
class Browser < Canvas field :version, type: Integer scope :recent, where(:version.gt => 3) end
which yields the following error:
message: Defining a scope of value #<Mongoid::Criteria:0x00007face0236ba0> on Browser is not allowed. summary: Scopes in Mongoid must be procs that wrap criteria objects. resolution: Change the scope to be a proc wrapped critera. Example: class Band include Mongoid::Document scope :inactive, ->{ where(active: false) } end
The suggested fix is as follows:
class Browser < Canvas field :version, type: Integer scope :recent, ->{ where(:version.gt => 3) } end