Skip to content
bogdan edited this page May 31, 2012 · 18 revisions

Scope

Simple scope definition

Datagrid scope as assets source to be queried from the database. In most cases it is a model class with some default ORM scopes like order or includes:

class MyGrid
 include Datagrid
 scope { Project.includes(:category) }
end

Scope is also used to choose a ORM driver(MongoMapper, Mongoid or ActiveRecord), get wether filters and columns defined below has order.

In some cases you need to change the scope of the fly:

grid = MyGrid.new
grid.scope do

# TODO compete this doc
Clone this wiki locally