-
Notifications
You must be signed in to change notification settings - Fork 332
Embedded Scaffolds
cntrytwist edited this page Sep 14, 2010
·
26 revisions
Embedding scaffolds allow you to reuse your scaffold and insert it into other views as a widget. You can specify constraints for your scaffold to limit the records it works with.
Rendering
To embed a scaffold in another controller, or on a page somewhere, use render :active_scaffold => "controller_id" (it’s a special call that will turn around and call render_component). You may pass ANY combination of parameters you would like: label, sort, sort_direction, search, and even constraints (covered later).
@
- render UsersController
render :active_scaffold => ‘users’
- the same, but this time change the heading to “Active Users”
render :active_scaffold => ‘users’, :label => ‘Active Users’
- sorting by `name`, ascending
render :active_scaffold => ‘users’, :sort => “name”, :sort_direction => “ASC”
@