Help on loop


   @f =

will overwrite @f each time through the loop. That's why you see only
the last value.

If you wanted to build up an array, you could write:

   @f = []
   for font in Magick.fonts
     @f <<

But you can do this all in one line:

   @f = Magick.fonts.collect &:family

(I'm assuming you're doing this in a Rails app. If you're doing it in
a standalone script, you would need to add "require 'active_support'"
for the &:family thingy to work)

This is equivalent to what ebeard showed, but uses some new sugar
Rails gives you. See I
think this is going to be standard in Ruby 1.9.

Something like this maybe?

<%= select("SomeModel", "SomeAttribute", @f {|f| [ f ] }), :prompt =>
"Select a font" %>

Guys ... put this in a helper ... littering your views with procedural
code. Will be difficult to maintain.