Rails has_many poprzez zapytanie w zależności od atrybutu tabele through
Problemy z zapytaniem has_many.
Korzystając z przykładu tutaj: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
W tabeli spotkań znajduje się kolumna o nazwieData spotkania
W jaki sposób otrzymam wszystkich pacjentów od konkretnego lekarza, którzy umówią się na konkretną datę?