Hi,
i ve got this piece of code :
<%= select("profile", "vlogiciel", @vlogiciel.collect
{|vlogiciel|
[ vlogiciel.logiciel.nom,
vlogiciel.id ] }, :include_blank=>true, :selected=>(@vl).to_i )%>
But i would like to do that
<%= select("profile", "vlogiciel", @vlogiciel.collect
{|vlogiciel|
[ vlogiciel.logiciel.nom + vlogiciel.lversion.nom,
vlogiciel.id ] }, :include_blank=>true, :selected=>(@vl).to_i )%>
But sometime vlogiciel.lversion is NULL,
so i need to add an unless condition like that :
<%= select("profile", "vlogiciel", @vlogiciel.collect
{|vlogiciel|
[ vlogiciel.logiciel.nom +
unless vlogiciel.lversion == nil
vlogiciel.lversion.nom
end, vlogiciel.id ] }, :include_blank=>true, :selected=>(@vl).to_i )%>
There is synthax error so it s not working.
i can t figure out how to add a conditions into this select...
Does anyone have an idea ?
Thanks
Guillaume.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Assemble your collection for the select in the controller where you have free reign on how the data is brought together and/or massaged for display? Or use an immediate if (or whatever Ruby calls it) [vlogiciel.logicial.nom+(vlogicial.lversion.nil? ? '''' : vlogicial.lversion), vlogiciel.id] Haven''t tried it myself, but that is left as "an exercise for the reader..." -- 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 -~----------~----~----~----~------~----~------~--~---
You are my star :) Thanks so much !!! On 15 avr, 17:03, Ar Chron <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Assemble your collection for the select in the controller where you have > free reign on how the data is brought together and/or massaged for > display? > > Or use an immediate if (or whatever Ruby calls it) > > [vlogiciel.logicial.nom+(vlogicial.lversion.nil? ? '''' : > vlogicial.lversion), vlogiciel.id] > > Haven''t tried it myself, but that is left as "an exercise for the > reader..." > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---