How to write dropdown menu for currentuser -
i'm noob in ror world , need help. question this: i've form
<div class="form-container"> <%= form_for([@modulo2.user, @modulo2]) |f| %> .......... <div class="form-field"> <h3> modulo1: </h3><br/> <%= f.select(:modulo1_id, modulo1.all.map{|p| [p.nome_progetto]}, :prompt => "seleziona il modulo1 associato") %> </div> </div><br/>
the result dropdown menu modulo1s need ones current_user. can try??? in adding, when select 1 item dropdown menu have no association values in table.
sorry question can't find answers searching.
i found solution:
<%= f.select(:modulo1_id, current_user.modulo1s.all.map{|p| [p.nome_progetto,p.id]}, :prompt => "seleziona il modulo1 associato") %>
i've 1 doubt, if need if statement boolean variable before select try??
Comments
Post a Comment