Rails has_many through query abhängig vom Attribut through table
Einige Probleme mit einer has_many durch Abfrage.
Mit dem Beispiel hier:http://guides.rubyonrails.org/association_basics.html#the-has_many-through-association
class Physician < ActiveRecord::Base
has_many :appointments
has_many :patients, :through => :appointments
end
class Appointment < ActiveRecord::Base
belongs_to :physician
belongs_to :patient
end
class Patient < ActiveRecord::Base
has_many :appointments
has_many :physicians, :through => :appointments
end
Die Termintabelle hat eine Spalte mit dem NamenTermin
Wie bekomme ich alle Patienten von einem bestimmten Arzt, der zu einem bestimmten Termin einen Termin hat?