mercredi 1 avril 2015

rails 3.0.10 conditions in select()

i have this select



<%= select("post", "field",@variable.all.collect) {|p| [ p.name, p.id ] }, :include_blank =>'blank')%>


to generate a dropdown of 4 registers


and i did



{|p| [ p.name, p.id ] if helper_method(p.id) }


expecting this output:



blank
reg4


instead i got this output:



blank



reg4


and i can't figure out how to get the expected output


Aucun commentaire:

Enregistrer un commentaire