On Nov 28, 2007 8:32 PM, emarthinsen
<emarthinsen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I have a class called Product that has a relationship with another
> class called Category. The Product "belongs_to :category" and the
> Category "has_many :products". In my admin controller for
Products,
> which I''m using scaffold to generate, I''d like to have a
drop-down
> list of the categories show up. Is there an easy way to do this, or
> should I generate the scaffold code and edit it by hand? Thanks in
> advance.
Here''s how to build a drop down menu:
http://api.rubyonrails.com/classes/ActionView/Helpers/FormOptionsHelper.html#M000512
If you scroll that page back up a little you''ll see several options
for making options to go with your drop down menu.
Scaffolds are neato and all but at some point they usually get tossed
out for custom code or heavily customized themselves.
--
Greg Donald
http://destiney.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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---