I currently have a drop down menu selection in an input form with hardcoded values, the problem I''m having is I want to use multiple word entries that users can select from, is there anyway of doing that? here is my code as it exists now <%= f.label :category, "Category" %><br /> <%= select ''article'', ''category'', %w(Cooperation EnvironmentalSustainability BusinessDevelopment Transportation Streetscape DenseMixedUse) %> obviously I need some of these to be two words as one entry instead of being multiple entries please help! -- 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 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 -~----------~----~----~----~------~----~------~--~---
On Mar 4, 2009, at 4:57 PM, Jimmy Perrine wrote:> I currently have a drop down menu selection in an input form with > hardcoded values, the problem I''m having is I want to use multiple > word > entries that users can select from, is there anyway of doing that? > > here is my code as it exists now > > <%= f.label :category, "Category" %><br /> > <%= select ''article'', ''category'', %w(Cooperation > EnvironmentalSustainability BusinessDevelopment Transportation > Streetscape DenseMixedUse) %> > > > obviously I need some of these to be two words as one entry instead of > being multiple entries > > please help!Just skip the shorthand: [''Cooperation'', ''Environmental Sustainability'', ''Business Development'', ''Transportation'', ''Streetscape'', ''Dense Mixed Use'' ] Even better might be a model to return the choices. class Category def self.choices_for_select [''Cooperation'', ''Environmental Sustainability'', ''Business Development'', ''Transportation'', ''Streetscape'', ''Dense Mixed Use'' ] end end <%= select ''article'', ''category'', Category.choices_for_select %> -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rob Biedenharn wrote:> Just skip the shorthand:It should also work by escaping the spaces: %w{Cooperation Environmental\ Sustainability Business\ Development Transportation Streetscape Dense\ Mixed\ Use} Note: noticed the curly braces %w{list of words} -- 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 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 -~----------~----~----~----~------~----~------~--~---
thanks guys, that was perfect -- 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 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 -~----------~----~----~----~------~----~------~--~---