Delegating ast to arel is deprecated

Viewed 504

I have the following in a Rails 5.1 app

class Products::LinkableToEvent
  ProductTable = Product.arel_table
  EventTable = Event.arel_table

  def self.call(slug)
    Product.all.
    where(ProductTable[:id].in(ProductTable.project(ProductTable[:id])
          .except(Product.select(:id)
          .joins("INNER JOIN events ON (products.id = 
          ANY(events.product_ids))")                                          
          .where(EventTable[:slug].eq(slug))
          .unscope(:order))))
  end
end

Which generates the warning below.

DEPRECATION WARNING: Delegating ast to arel is deprecated and will be removed in Rails 6.0. (called from call at /em/app/queries/products/linkable_to_event.rb:8)

Line 8 is .except(Product.select(:id)

How can I remove the warning?

0 Answers
Related