If you take a look at Activescaffold per Request Configuration you will learn that you have to create a before_filter to be able to change column set per request.
Well, that does nt feel right, before_filters should be used for aspect oriented programming tasks such as authentication, logging,..
However, it was quite complicated to do it another way with Activescaffold.
I ve added a new feature to my fork which allows you to change column set configuration for a specific action without before_filters.
It s actually really easy, every action has a new method _columns, which you may override in your controller.
Let me give you some easy examples:
def update_columns
columns = super
if @record.id == 85
columns.select {|column| column.name != :last_name}
else
columns
end
end
def field_search_columns
columns = super
if sunny_weather
columns.select {|column| column.name != :rain}
end
Wish you a great weekend.