I use a lot of this but I am struggling to get it to show the ''selected value. <%= options = [[''Select Facility'', "" ] ] + @facilities.sort { |a,b| a.name <=> b.name }.collect { |fac| [fac.name, fac.id] } select ''counseling_note'', ''fi_facility_id'', options %> This is fine but I want it to show the currently selected value. How would I modify the above to show the current value (Either fac.name or fac.id)? @counseling_note.fi_facility_id = 9 @counseling_note.fi_facility = "Some Facility Name" or I can set @fi_facility or I can set @fi_facility_id but I can''t get it to show the selected value. Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I use a lot of this but I am struggling to get it to show the ''selected value...I think that my issue is that I''m using an indexed array. <%= options = [[''Select Facility'', "" ] ] + @facilities.sort { |a,b| a.name <=> b.name }.collect { |fac| [fac.name, fac.id] } select ''counseling_note'', ''fi_facility_id'', options %> This is fine but I want it to show the currently selected value. How would I modify the above to show the current value (Either fac.name or fac.id)? @counseling_note.fi_facility_id = 9 @counseling_note.fi_facility = "Some Facility Name" or I can set @fi_facility or I can set @fi_facility_id but I can''t get it to show the selected value. Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I use a lot of this but I am struggling to get it to show the ''selected value...I think the issue is that I have an a hash... <%= options = [[''Select Facility'', "" ] ] + @facilities.sort { |a,b| a.name <=> b.name }.collect { |fac| [fac.name, fac.id] } select ''counseling_note'', ''fi_facility_id'', options %> This is fine but I want it to show the currently selected value. How would I modify the above to show the current value (Either fac.name or fac.id)? @counseling_note.fi_facility_id = 9 @counseling_note.fi_facility = "Some Facility Name" or I can set @fi_facility or I can set @fi_facility_id but I can''t get it to show the selected value. Craig --~--~---------~--~----~------------~-------~--~----~ 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 Mon, 2008-03-24 at 14:28 -0700, Craig White wrote:> I use a lot of this but I am struggling to get it to show the ''selected > value. > > <%= options = [[''Select Facility'', "" ] ] + @facilities.sort > { |a,b| a.name <=> b.name }.collect { > |fac| [fac.name, fac.id] } > select ''counseling_note'', ''fi_facility_id'', options %> > > This is fine but I want it to show the currently selected value. > > How would I modify the above to show the current value (Either fac.name > or fac.id)? > > @counseling_note.fi_facility_id = 9 > @counseling_note.fi_facility = "Some Facility Name" > or I can set @fi_facility > or I can set @fi_facility_id > > but I can''t get it to show the selected value.---- obviously people can ignore this e-mail and the one that followed an hour later when this one didn''t show up because the issue was solved. What is a mystery is how google groups seemingly ''lost'' these and I notice some other older e-mails from various other senders also showed up on the list today. Looking at the headers, it''s clear that these e-mails were received by Google in a timely manner but they hung around for 4 days before going out to the list. Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---