Post Meta

Bookmarks

  • Delicious
  • Digg
  • Reddit
  • Magnolia
  • Newsvine
  • Furl
  • Facebook
  • Technorati

Sometimes a model managed with ActiveScaffold must be visualized/configured in different ways.

For example, in a view will be shown more columns than in another view.

This can be done easily by passing a parameter for the controller, and using a before_filter in the controller.

1
2
 
render_component(:controller =>controller_name, :params => {:filter => filter})

and

1
2
3
4
5
6
7
8
9
10
11
 
before_filter :update_as_config
 
....
 
private
 
# configure AS based on parameters
def update_as_config
active_scaffold_config.list.columns.add [:roles] unless params[:filter].nil?
end


Related posts

Leave A Comment

+ -