How to performe left outer query with conditions. ActiveRecord, as I read, doesn't allow to make what I want. I try this:
Platform.where(url: urls).includes(:campaign_platforms).where.not('campaign_platforms.campaign_id = ?', campaign.id)
and get "Mysql2::Error: Unknown column 'campaign_id' in 'where clause'..."
UPD:
 class Platform < ActiveRecord::Base
   has_many :campaign_platforms
   has_many :campaigns, through: :campaign_platforms
   has_many :posts
   has_many :screenshoots
   belongs_to :platform_category
   belongs_to :user
 end
 class CampaignPlatforms < ActiveRecord::Base
    belongs_to :campaign, dependent: :destroy
    belongs_to :platform, dependent: :destroy
 end
 class Campaign < ActiveRecord::Base
    has_many :campaign_platforms
    has_many :platforms, through: :campaign_platforms
 end
 
     
     
     
    