Sha256: 4aeace117a61f971ac7c027ff91e63c88e68288d6f12e673f52a8e560073c47d

Contents?: true

Size: 464 Bytes

Versions: 15

Compression:

Stored size: 464 Bytes

Contents

# frozen_string_literal: true

class Account < ActiveRecord::Base
  has_many :memberships, inverse_of: :account, dependent: :destroy, class_name: '::Account::Member'
  has_many :users, through: :memberships, inverse_of: :accounts

  where_ownership = -> { where(account_members: {role: :owner}) }

  has_one :ownership, where_ownership, dependent: nil, inverse_of: :account, class_name: '::Account::Member'
  has_one :owner, through: :ownership, source: :user
end

Version data entries

15 entries across 8 versions & 3 rubygems

Version Path
solid-result-2.0.0 examples/multiple_listeners/app/models/account.rb
solid-result-2.0.0 examples/single_listener/app/models/account.rb
solid-result-2.0.0 examples/service_objects/app/models/account.rb
bcdd-result-1.1.0 examples/single_listener/app/models/account.rb
bcdd-result-1.1.0 examples/multiple_listeners/app/models/account.rb
bcdd-result-1.1.0 examples/service_objects/app/models/account.rb
bcdd-result-1.0.0 examples/multiple_listeners/app/models/account.rb
bcdd-result-1.0.0 examples/single_listener/app/models/account.rb
bcdd-result-1.0.0 examples/service_objects/app/models/account.rb
bcdd-process-0.4.0 examples/business_processes/app/models/account.rb
bcdd-process-0.3.1 examples/business_processes/app/models/account.rb
bcdd-process-0.3.0 examples/business_processes/app/models/account.rb
bcdd-process-0.2.0 examples/business_processes/app/models/account.rb
bcdd-result-0.13.0 examples/single_listener/app/models/account.rb
bcdd-result-0.13.0 examples/multiple_listeners/app/models/account.rb