I have a select list in my edit form and i want to see the right ethinicty selected for the person i am editing
<%= simple_nested_form_for @person do |f| %>
<%= f.input :first_name %>
<%= f.input :last_name %>
<%= f.input :ethnicity,
collection: Person.select('distinct ethnicity'),
:label_method => :ethnicity,
:input_html => {:class => 'chosen-select'} %>
<input type="submit" value="Update Person" name="commit" class="btn-edit">
<% end %>
Person.rb
class Person < ActiveRecord::Base
attr_accessible :ethnicity, :description, :first_name, :last_name
I want the right value for the ethnicity selected on edit. How do i do that?
With what i did i don't have a value for ethnicity when i am on the edit page