I have a simple has_many through: table
class User < ApplicationRecord
has_many :memberships
end
class Membership < ApplicationRecord
enum :status, [:inactive, :active]
belongs_to :user
belongs_to :location
end
class Location < ApplicationRecord
has_many :memberships
has_many :users, through: :memberships
end
This finds all memberships at a location that are active
Location.first.memberships.active
Is there a clean way to find all users at a location that are active? This does not work
Location.first.users.active