Frederick Cheung wrote: > On Mar 21, 1:44�pm, Scott Kulik <rails-mailing-l...@andreas-s.net> > wrote: >> > Hashes are not ordered in ruby 1.8 - if you want an ordering use an > array (eg [['Yes', 1], ['No',0]]). > For an option to be preselected it's value (the second bit) must be > equal to the last argument to select_tag (equal in the sense of ==, so > in particular '1' != 1) > > In your case you are passing params[:fake].to_i. If there are no > parameters then params[:fake] is nil, and nil.to_i == 0 so rails > selects the option with value 0. > > Fred
thanks fred. changing to an array fixed the ordering problems. for the select statement, i changed the initial value for -->Fake to -1 select_tag(:fake, options_for_select([["-->Fake","-1"],["Yes",1],["No",0]], params[:fake].to_i)) everything works great! -- 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---