[Rails] displaying foreign keys help request

Alex Young
Tue, 07 Feb 2006 09:41:13 -0000

Mark Probert wrote:
>    @mt = MemberType.find( :all, :order => "info" )
>    select( :member_type_id, :member_type, @mt )
The select methods actually takes an array of 2-member lists, just like
you''d get if you did a Hash#to_a call.  This may work for you:

@mt = MemberType.find(:all, :order => "info")
select( :member, :member_type_id, @mt.collect{|t| [t.info, i.id]} )

This is documented at
http://api.rubyonrails.com/classes/ActionView/Helpers/FormOptionsHelper.html#M000351

--
Alex