Snapmail
|> preload(:user)
|> preload(:snapmail_cameras)
|> preload([snapmail_cameras: :camera])
|> preload([snapmail_cameras: [camera: :vendor_model]])
|> preload([snapmail_cameras: [camera: [vendor_model: :vendor]]])
|> Repo.all
I have above query in Ecto. in this. Each snapmail has a snapmail_camera and snapmail_camerahas a camera_id which is camera's id (from camera table.)
and Cameras table has a field status.
I am trying to get only those snapmails where its snapmail_cameras's camera's status is not equal to project_finished
this is the relation of snapmail and snapmail_camera
belongs_to :user, User, foreign_key: :user_id
has_many :snapmail_cameras, SnapmailCamera
any help would be so thankful. How I can get those snapmails?