I''m newbie for ROR. I was create select box for employee who swap position when they work. ex. mr.John has default position as a service but he can swap position to driver . In select box i want to show default position first. but my app it not show default first it must select by myself. how i create the select box by selected value with ROR command now i use <select name="area_id_<%=person.id%>_<%=date%>"> <%= options_from_collection_for_select @areas, :id, :name, (shift.area_id if shift) %> -- 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 -~----------~----~----~----~------~----~------~--~---
Use collection_select Blog: http://random8.zenunit.com/ Learn rails: http://sensei.zenunit.com/ On 04/02/2009, at 6:58 PM, Nopp Deew <rails-mailing-list@andreas- s.net> wrote:> > I''m newbie for ROR. > > I was create select box for employee who swap position when they work. > > ex. mr.John has default position as a service but he can swap position > to driver . > > In select box i want to show default position first. > > but my app it not show default first it must select by myself. > > how i create the select box by selected value with ROR command > > now i use > > <select name="area_id_<%=person.id%>_<%=date%>"> > <%= options_from_collection_for_select @areas, :id, :name, > (shift.area_id if shift) %> > -- > 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 -~----------~----~----~----~------~----~------~--~---
Julian Leviston wrote:> Use collection_selectProgram has been error >> wrong number of arguments (4 for 5) error on line 28 27: <select name="area_id_<%=person.id%>_<%=date%>"> 28: <%= collection_select @areas, :id, :name, (shift.area_id if shift) %> 29: </select> -- 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 -~----------~----~----~----~------~----~------~--~---
No! Use intelligence! the entire select tag is replaced by collection select. Look on the API for syntax. Blog: http://random8.zenunit.com/ Learn rails: http://sensei.zenunit.com/ On 05/02/2009, at 4:42 AM, Nopp Deew <rails-mailing-list@andreas- s.net> wrote:> > Julian Leviston wrote: >> Use collection_select > > Program has been error >> > > wrong number of arguments (4 for 5) > > error on line 28 > > 27: <select name="area_id_<%=person.id%>_<%=date%>"> > 28: <%= collection_select @areas, :id, :name, (shift.area_id > if > shift) %> > 29: </select> > > -- > 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 -~----------~----~----~----~------~----~------~--~---