m247/tickets — comment on commit 2fd4c883eb403d15e72b1ea142743e2a2a1cce7f
File: app/models/issue.rb line 5
By geoffgarside:

For things like that I'd leave the PRIORITIES and STATUSES as arrays of strings. The priority and status fields in the database would then be one of these string values. So `validates_inclusion_of :priority, :in => PRIORITIES`.

For the forms I'd then use

= f.select :priority, Issue::PRIORITIES.map { |p| [p, p] }

as a simple case.

You can quite pleasantly use the I18n translation stuff to make it nicer, such as

= f.select :priority, Issue::PRIORITIES.map { |p| [t("issue.priorities.#{p}"), p] }

which will then look up the `issue.priorities.bronze`, `issue.priorities.silver`, `issue.priorities.gold` or `issue.priorities.platinum` translations accordingly. You'd then also use these localisation keys when showing the priority levels in the templates. You'd probably use a helper for this.