Hi All, controller: def html @tag1=["Arun","Babu",Chitra"] end html.html.erb : <%= select_tag "@tag1","<option>#{@tag1[0]}</option><option>#{@tag1[1]}</option> "%><br/> It was working fine. But my question is any other simple ways are available. Because i have array in controller, but using individually in view.. Awaiting your reply Thanks P.Raveendran http://raveendran.wordpress.com -- 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 -~----------~----~----~----~------~----~------~--~---
Hi All, i herewith written my final working code..... controller: def htmlhelp @tag=["a","b","c","d"] @collection=[] @tag.each do |value| value="<option>"+value+"</option>" @collection << value end end View: <%= select_tag "@tag12", @collection.to_s %> Any other short ways...? Regards, P.Raveendran http:raveendra.wordpress.com -- 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 Sat, Jul 26, 2008 at 3:03 AM, Raveendran Jazzez <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi All, > > i herewith written my final working code..... > > controller: > > def htmlhelp > @tag=["a","b","c","d"] > @collection=[] > > @tag.each do |value| > value="<option>"+value+"</option>" > @collection << value > end > end > > View: > > <%= select_tag "@tag12", @collection.to_s %>you can try <%= select_tag @tag12, options_for_select( @tag ) -- Gabriel Laskar <bibi.skuk-Re5JQEeQqe8AvxtiuMwx3w@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 -~----------~----~----~----~------~----~------~--~---
Gabriel Laskar wrote:> you can try > <%= select_tag @tag12, options_for_select( @tag ) > > > -- > Gabriel Laskar <bibi.skuk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>Hi Laskar, Thanks a lot for ur quick and beautiful code help. Regards, P.Raveendran http://raveendran.wordpress.com -- 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 -~----------~----~----~----~------~----~------~--~---
Raveendran Jazzez wrote:>> <%= select_tag @tag12, options_for_select( @tag )> Hi Laskar,> Thanks a lot for ur quick and beautiful code help.Now try this one. The @yo object has a list of ids from the a model called Mod. We need this to make the ids sticky in the form: form_for :yo do |f| f.collection_select(:ids, Mod.find(:all), :id, :name) The problem is, even after we make all that pseudo-Rails into real Rails code, with all the right arguments, the ids are not sticky. (Sticky means if you serve the page twice with the same @yo object, the same Mod items should still be selected.) Any ideas? We had to go back to select_tag, and generally do for ourselves everything f.collection_select was supposed to do. -- Phlip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---