How do I select the selected value in a select list? Can''t find any documentation about that. -- 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 -~----------~----~----~----~------~----~------~--~---
Pål Bergström wrote:> How do I select the selected value in a select list? Can''t find any > documentation about that.I figured that out myself. Now I wonder how I can add a default value, or a blank value but with a default value to that? -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Pål Bergström wrote:> Pål Bergström wrote: > > How do I select the selected value in a select list? Can''t find any > > documentation about that. > > I figured that out myself. Now I wonder how I can add a default value, > or a blank value but with a default value to that? > > -- > Posted via http://www.ruby-forum.com/.Did you find a way to generate a select list with a selected value using a build in rails method, or did you write one of your own? This is something I needed to do recently, but I wrote my own method ... just wondering if there is a build in way! --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
stephen O''D wrote:> P�l Bergstr�m wrote: >> P�l Bergstr�m wrote: >> > How do I select the selected value in a select list? Can''t find any >> > documentation about that. >> >> I figured that out myself. Now I wonder how I can add a default value, >> or a blank value but with a default value to that? >> >> -- >> Posted via http://www.ruby-forum.com/. > > Did you find a way to generate a select list with a selected value > using a build in rails method, or did you write one of your own? This > is something I needed to do recently, but I wrote my own method ... > just wondering if there is a build in way!Not sure what you mean, but I learned it from Agile Web Developments with Rails. There it states: <%@users = User.find(:all, :order => "name").map {|u| [u.name, u.id] } select(:user, :name, @users) %> This way I can populate the list select() with data from the table Users (in this case). Besides that I''ve been really struggling to find answers about select list, and many other things. Getting more and more frustrated with the really poor documentation in Rails. But try to stay happy :-) Hopefully someone some day will write a better documentation. -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Pål Bergström wrote:> This way I can populate the list select() with data from the table Users > (in this case).And it will automatically select the current value in the db. -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---