ActiveScaffold :: Wiki
Active Scaffold List Eval

Active Scaffold List Eval

Overview

I was unable to find a way use the normal controller helper module mechanism to provide column overrides because I was generating my AS enabled controller dynamically. This simple AS plugin provides a new attribute to columns that you can pass either a string representation of code or Proc and that code will be executed in the same way as a <column_name>_column(record) helper method.

The actual plugin might not be useful to many people, but it is a nice simple example of how to override and extend Active Scaffold.

Download

http://groups.google.com/group/activescaffold/web/active_scaffold_list_eval.tar.gz

Installation

Unpack tgz file into your vendor/plugins directory

Usage

Set the list_eval property on a column object to a code string or Proc.


config.columns[:title].list_eval = <<EOS
  if record.title.length > #{@@max_title_length}
    content_tag :abbr, record.title.first(#{@@max_title_length}), :title => record.title
  else
    record.title
  end
EOS