jeudi 19 février 2015

Rails Load Dropdowns from another model based on values in another model

I have a model for checklist questions see below image url.


http://ift.tt/19BnJQ6


Load all the questions from OrderCheckListQuest Model, OrderCheckListQuest has some questions have dropdowns so I created another Model named as OrderDpValues. and my question is how to show the dpvalues to views?


My View is :



<% @chk_quest.each do |chk| %>
<div class="clear row-space marginleft5">
<div class="clearfix">
<div>
<div class="checklist_label pull-left" <% if chk.dp_id == 'Y' %> style="width: 281px;" else style="" <% end %>>
<%= chk.questions %>
</div>
<% if chk.dp_id == 'Y' %>
<div class="pull-left">

</div>
<% end %>
<div class="checklist_option pull-left">
<%= text_field "", "order_checklist[chk_sale][#{ chk.id }]" ,:class=>'checklist_input validate[required]' %>
</div>
<div class="checklist_option pull-left">
<%= text_field "", "order_checklist[chk_SE][#{ chk.id }]" ,:class=>'checklist_input validate[required]' %>
</div>
</div>
</div>


Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire