I am using ActiveAdmin gem in my project.
I have 2 models using has_many through association. The database schema looks exactly the same as the example in RailsGuide
@monfresh @tomblomfield you can do
has_many :appointments, ->{ includes(:patients) }, :through => :patients
in the physicians model
...or, I'm not sure if you can use it with formtastic but you could make the scope optional with something like
has_many :appointments :through => :patients do
def with_patients
includes(:patients)
end
end
and appointment.patient
wont n+1 anymore