class Pakyow::Data::Sources::Relational::Associations::HasMany

@api private

Attributes

associated_name[R]
dependent[R]

Public Class Methods

new(as:, dependent:, **common_args) click to toggle source
# File lib/pakyow/data/sources/relational/associations/has_many.rb, line 16
def initialize(as:, dependent:, **common_args)
  super(**common_args)

  @associated_name = Support.inflector.pluralize(as).to_sym
  @dependent = dependent
end

Public Instance Methods

associated_query_field() click to toggle source
# File lib/pakyow/data/sources/relational/associations/has_many.rb, line 43
def associated_query_field
  :"#{Support.inflector.singularize(@associated_name)}_#{@source.primary_key_field}"
end
dependents?() click to toggle source
# File lib/pakyow/data/sources/relational/associations/has_many.rb, line 47
def dependents?
  true
end
foreign_key_field() click to toggle source
# File lib/pakyow/data/sources/relational/associations/has_many.rb, line 35
def foreign_key_field
  associated_query_field
end
query_field() click to toggle source
# File lib/pakyow/data/sources/relational/associations/has_many.rb, line 39
def query_field
  @source.primary_key_field
end
result_type() click to toggle source
# File lib/pakyow/data/sources/relational/associations/has_many.rb, line 31
def result_type
  :many
end
specific_type() click to toggle source
# File lib/pakyow/data/sources/relational/associations/has_many.rb, line 27
def specific_type
  :has_many
end
type() click to toggle source
# File lib/pakyow/data/sources/relational/associations/has_many.rb, line 23
def type
  :has
end