Ability to reverse where conditions and define a reverse scope of existing one

   class Post < ActiveRecord::Base

     scope :active, -> { where(active: true) }
     reverse_scope :inactive, :active

     scope :created_before, ->(date) { where("posts.created_at < date")
     invert_scope :created_after, :created_before

     scope :trending, -> { joins(:category).where(categories: {treding: true})
     invert_scope :abandon, :trending

   end

   Post.inactive # => WHERE `active` != 1
   Post.created_after('1986-08-05') # => WHERE NOT(posts.created_at < '1986-08-05')
   Post.abandon # => INNER JOIN `categories` ON `categories`.id = `posts`.`category_id` WHERE `categories`.`treding` != 1