Multiple choices inside the model

Hi,

I'm trying to define multiple choices inside the rails model. In Django I would do something like this:

location = models.CharField(                                          max_length=3,                                          choices=LOCATION_CHOICES,                                          help_text="Which location do you prefer?"                                          )

LOCATION_CHOICES = (                                       ('AMS', 'Amsterdam'),                                       ('RTM', 'Rotterdam'),                                       ('HAG', 'The Hague'), )

What is the Rails equivalent of the above code? I've tried searching the Rails docs and Googling, but with no luck.

Thanks!

I don't know Django, but it looks to me like you are trying to setup a hash.

location_choices can be a local variable, instance variable, constant, etc depending on your needs.

@location_choices = { "AMS" => "Amsterdam", "RTM" => "Rotterdam" }

If you want it to be a constant, just capitalize it. Local variable, no @ sign.

Andrew