Sha256: feecd51e51ac40ea8a01411634b6db8304d0a488a73e80b6517ad3e2767bbfa5

Contents?: true

Size: 558 Bytes

Versions: 15

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

class User < ActiveRecord::Base
  has_secure_password

  has_many :memberships, inverse_of: :user, dependent: :destroy, class_name: '::Account::Member'
  has_many :accounts, through: :memberships, inverse_of: :users

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

  has_one :ownership, where_ownership, inverse_of: :user, class_name: '::Account::Member'
  has_one :account, through: :ownership, inverse_of: :owner

  has_one :token, inverse_of: :user, dependent: :destroy, class_name: '::User::Token'
end

Version data entries

15 entries across 8 versions & 3 rubygems

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