<s>[INST] class Base < ActiveRecord::Base
  self.abstract_class = true
end

class User < Base
  has_many :orders, -> { where.not(status: "cancelled") }
end

class Product < Base
  has_many :orders, -> { where.not(status: "cancelled") }
end

class Order < Base
  belongs_to :user
  belongs_to :product
end
class Order < Base
  # Add associations and validations here
end

class PaymentMethod < Base
  has_many :orders
end
We have the order status in our database as an enum with the following values: ["pending", "in_progress", "shipped", "delivered", "cancelled"]
Here is the order in our db looks like:

 id | user_id | product_id | payment_method_id | status 
 1  | 1       | 1          | 1               | shipped 
 2  | 1       | 2          | 1               | in_progress 
 3  | 1       | 3          | 1               | pending 
 4  | 2       | 4          | 2               | cancelled 
 5  | 2       | 5          | 2               | cancelled
We should return the active orders for each user (active orders are those which are not cancelled). How can I write the most efficient query for that?[/INST]