Scott Rutherford

Life on and off the Rails

 

I”ve been asked a couple of times how to dynamically setup the columns displayed by the AS plugin dependant on the permissions of the user, so I though a quick post would be a good idea.

Basically its very simple, you simply define a hash of all the columns you potentially wish to display keyed by the column name, so something like:

@@columns_hash[:user] = ScaffoldColumn.new(..)
@@columns_hash[:foo] = ScaffoldColumn.new(:name => 'bar')

Then define a before_filter along the lines of:

before_filter :create_columns, :only => ['table', 'update_table']

Read the rest of this entry

I released a new version of the plugin today that fixes a few outstanding issues and adds 3 new extension points. The main things that have been fixed are:

  1. Single table inheritance now works
  2. Legacy table names are now supported
  3. The table formats properly under IE

The 3 extra extra extension points are

  1. do_new
  2. do_edit
  3. do_delete

I will update the post on extending the plugin to fully cover these new features.

This blog used the Shay theme as a base and is powered by Mephisto