I want to generate a select-field with options: 50 55 60 ... 80 So I tried: <% @options = [] %> <%= 50.step(80, 5) { |a| @options = a}%> <%= select("DL","bandwidth", options) %> No success at all! Any hints? Thanx -- Jochen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jochen Kaechelin schrieb:> I want to generate a select-field with options: > > 50 > 55 > 60 > ... > 80 > > So I tried: > > <% @options = [] %> > <%= 50.step(80, 5) { |a| @options = a}%> > <%= select("DL","bandwidth", options) %> > > > No success at all! > > Any hints? > > Thanx > >Ups....sorry I solved it by my own: I changed @options = a to @options << a!! -- Jochen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2006-Dec-17 18:50 UTC
Re: Problem with select and options
Hi -- On Sun, 17 Dec 2006, Jochen Kaechelin wrote:> > Jochen Kaechelin schrieb: >> I want to generate a select-field with options: >> >> 50 >> 55 >> 60 >> ... >> 80 >> >> So I tried: >> >> <% @options = [] %> >> <%= 50.step(80, 5) { |a| @options = a}%> >> <%= select("DL","bandwidth", options) %> >> >> >> No success at all! >> >> Any hints? >> >> Thanx >> >> > > Ups....sorry I solved it by my own: > > I changed @options = a to @options << a!!That''s going to give you a flat array, though, when what you probably want is an array of arrays. If so, you could do: @options << [a,a] Also, your second <%= should be a <% and you need to decide whether (@)options is or is not an instance variable :-) David -- Q. What''s a good holiday present for the serious Rails developer? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) aka The Ruby book for Rails developers! Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.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 -~----------~----~----~----~------~----~------~--~---