How do I translate the following to simple form?
<%= form_for(@bill) do |f| %> <%= f.label :location_id %> <%= f.collection_select(:location_id, @locations, :id, :location_name, {:selected => @bill.location_id}) %>
I can't use a simple association because @locations is the result of a where query.
Try this
<%= simple_form_for @bill do |f| %> <%= f.input :location,:collection => @locations,:label_method => :location_name,:value_method => :id,:label => "Location" ,:include_blank => false %> <%= f.button :submit %> <%end%>
Hope this help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With