title: Radio buttons using simple_form on a has_many through association specifically on the belongs_to side of the association
body: <p>I'm trying to figure out how can I have list of physicians in my appointment form as radio_buttons. Now if I use "f.input :physician_id, :as => :radio_buttons" I'm getting a "Yes/No" radio buttons. And if I change to "f.association :physician_id, :as => :radio_buttons", then I'm getting RuntimeError "Association :user_id not found".</p>
  
  <p>By the way, i'm using simple_form for this.</p>
  
  <p>Thanks.</p>
  
  <p>My Appointment form:</p>
  
  <pre><code>&lt;%= simple_form_for(@appointment) do |f| %&gt;
    &lt;div class="form-inputs"&gt;
      &lt;%= f.hidden_field :patient_id %&gt;
      &lt;%= f.input :physician_id, :as =&gt; :radio_buttons %&gt;
      &lt;%= f.hidden_field :appointment_date, :value =&gt; DateTime.now  %&gt;
    &lt;/div&gt;
  
    &lt;div class="form-actions"&gt;
      &lt;%= f.button :submit, "Create Appointment" %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>My models:</p>
  
  <p>/app/models/physician.rb</p>
  
  <pre><code>class Physician &lt; ActiveRecord::Base
    has_many :appointments
    has_many :patients, :through =&gt; :appointments
  
    attr_accessible :physician_name
  end
  </code></pre>
  
  <p>/app/models/appointment.rb</p>
  
  <pre><code>class Appointment &lt; ActiveRecord::Base
    belongs_to :physician
    belongs_to :patient
  
    attr_accessible :physician_id, :patient_id, :appointment_date, :state
  end
  </code></pre>
  
  <p>/app/models/patient.rb</p>
  
  <pre><code>class Patient &lt; ActiveRecord::Base
    has_many :appointments
    has_many :physicians, :through =&gt; :appointments
  
    attr_accessible :patient_name
  end
  </code></pre>
  
  <p>My Controllers:</p>
  
  <p>/app/controllers/appointment_controller.rb</p>
  
  <pre><code>class AppointmentsController &lt; ApplicationController
    def new
      @appointment = Appointment.new
      @appointment.patient_id = params[:patient_id]
    end
  
    def create
      @appointment = Appointment.new(params[:appointment])
  
      if @appointment.save
        flash[:notice] = "New appointment record created"
        redirect_to dashboards_path
      else
        render 'new'
      end
    end
  end
  </code></pre>