simple form - Rails 4 simple_form collection_select -


how translate following simple form?

<%= form_for(@bill) |f| %>  <%= f.label :location_id %> <%= f.collection_select(:location_id, @locations, :id, :location_name,        {:selected => @bill.location_id}) %> 

i can't use simple association because @locations result of query.

try

<%= simple_form_for @bill |f| %>    <%= f.input :location,:collection => @locations,:label_method => :location_name,:value_method => :id,:label => "location" ,:include_blank => false %>    <%= f.button :submit %> <%end%> 

hope help


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -