Merge A Scope Into An ActiveRecord Query
class Book < ApplicationRecord
scope :published, -> { where("books.published_at is not null") }
endpublished_authors =
Authors.joins(:book).where("books.published_at is not null")published_authors =
Authors.joins(:book).merge( Book.published )Last updated