I have just jumped into has_many :through
association. I\'m trying to implement the ability to save data for all 3 tables (Physician
, Patient
"i got it working. I just changed models as follows" : quoted from Shruti in the comments above
class Patient < ActiveRecord::Base
has_many :appointments, :dependent => :destroy
has_many :physicians, :through => :appointments
accepts_nested_attributes_for :appointments
end
class Appointment < ActiveRecord::Base
belongs_to :physician
belongs_to :patient
accepts_nested_attributes_for :physician
end