I have a number of such lists in my Rail application:
& Lt; Li & gt; ; Company & lt; Span & gt; & Lt;% = f.select: company_id, Company.all.collect {| M [M.com.paninem, mid]}%> & Lt; / Span & gt; & Lt; / Li & gt;
They all work well, except - sometimes if you go to the editing scene, the selection list comes back to the top item, not select that item. , Which is why when you go to an edit view while creating and then actually click on the update without making any changes, the lists by default on the top item - although you do not touch them.
Is there a way to it?
Thanks,
Danny
Edit:
& lt; Form_for (@kase)% ,: HTML = & gt; {: Multipurpose = & gt; True} what? F | & Gt%; & Lt; Li & gt; Appointed surveyor & lt; Span & gt; & Lt;% = f.select: appointedsurveyor_id, Company.all.collect {| M [M.companyname, m.id]}, {: selected = & gt; @ Kase.appointedsurveyor_id}%> & Lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; Surveyor's Name & lt; Span & gt; & Lt;% = f.select: surveyorperson_id, person.all.collect {| X | [X.personname, x.id]}, {: selected = & gt; @ Kase.surveyorperson_id}%> & Lt; / Span & gt; & Lt; / Li & gt;
I have tried the above, but sadly it is still coming back to the default value.
I got stuck on this, I can not find any tutorials etc.
Edit 2:
Written; Designated Surveyor & lt; Span & gt; & Lt;% = f.select: Appointing Authority_ID, Company.All Collect {| M [M.companyname, m.id]}, {: selected = & gt; (@cas.extservevair_id rescue "")}}%> & Lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; Surveyor's Name & lt; Span & gt; & Lt;% = f.select: surveyorperson_id, person.all.collect {| X | [X.personname, x.id]}, {: selected = & gt; (@cais surveyorperson_id Rescue "")}%> & Lt; / Span & gt; & Lt; / Li & gt;
Comments
Post a Comment