On 7 Jan 2009, at 11:08, David Nicholson wrote:
>
> I've got a constant of difficulty levels in my 'Tutorial' model
> which is
> a hash of
>
> DIFFICULTIES = {"Beginner" => 1, "Intermediate" => 2, "Advanced" => 3}
>
> However when I pass it to my options_for_select helper they appear
> in a
> completely different order. Is there any way to keep them in the
> correct
> order?
>
Hashes are unordered (at least in ruby 1.8). As far as
options_for_select is concerned you can use something like
[['Beginner', 1], ...]
> Also is this the best way to keep a small list like this that isn't
> related to a database table?
constant in the tutorial model sounds fine to me.
Fred
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---