views:

266

answers:

1

I have several models with fields that are integers. I also have hashes that associate integers with strings (1 => Blue, 2 => Red, that sort of thing).

How do you turn these into dropdown lists in an ActiveScaffold (http://github.com/activescaffold) controller? Do you need custom code, or is there just a customization that I'm not seeing?

+1  A: 

You can use Form Overrides. In the controller helper you can define a method named #{column_name}_form_column which is responsible for displaying the input element of your field.

For example I have:

def referral_type_form_column(record, input_name)
  select :record, :referral_type, ['', 'A', 'B', 'C'], :name => input_name
end
Guy C