Skip to content
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).

@

  1. render UsersController
    render :active_scaffold => ‘users’
  1. the same, but this time change the heading to “Active Users”
    render :active_scaffold => ‘users’, :label => ‘Active Users’
  1. sorting by `name`, ascending
    render :active_scaffold => ‘users’, :sort => “name”, :sort_direction => “ASC
    @

Clone this wiki locally