Class: Pakyow::Data::Sources::Relational::Associations::HasMany Private
- Inherits:
-
Pakyow::Data::Sources::Relational::Association
- Object
- Pakyow::Data::Sources::Relational::Association
- Pakyow::Data::Sources::Relational::Associations::HasMany
- Defined in:
- lib/pakyow/data/sources/relational/associations/has_many.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #associated_name ⇒ Object readonly private
- #dependent ⇒ Object readonly private
Attributes inherited from Pakyow::Data::Sources::Relational::Association
#associated_source, #associated_source_name, #name, #query, #source
Instance Method Summary collapse
- #associated_query_field ⇒ Object private
- #dependents? ⇒ Boolean private
- #foreign_key_field ⇒ Object private
-
#initialize(as:, dependent:, **common_args) ⇒ HasMany
constructor
private
A new instance of HasMany.
- #query_field ⇒ Object private
- #result_type ⇒ Object private
- #specific_type ⇒ Object private
- #type ⇒ Object private
Methods inherited from Pakyow::Data::Sources::Relational::Association
#dependent_source_names, #internal!, #internal?
Constructor Details
#initialize(as:, dependent:, **common_args) ⇒ HasMany
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of HasMany.
16 17 18 19 20 21 |
# 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 |
Instance Attribute Details
#associated_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/pakyow/data/sources/relational/associations/has_many.rb', line 14 def associated_name @associated_name end |
#dependent ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/pakyow/data/sources/relational/associations/has_many.rb', line 14 def dependent @dependent end |
Instance Method Details
#associated_query_field ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 |
# 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? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/pakyow/data/sources/relational/associations/has_many.rb', line 47 def dependents? true end |
#foreign_key_field ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/pakyow/data/sources/relational/associations/has_many.rb', line 35 def foreign_key_field associated_query_field end |
#query_field ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/pakyow/data/sources/relational/associations/has_many.rb', line 39 def query_field @source.primary_key_field end |
#result_type ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/pakyow/data/sources/relational/associations/has_many.rb', line 31 def result_type :many end |
#specific_type ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/pakyow/data/sources/relational/associations/has_many.rb', line 27 def specific_type :has_many end |
#type ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/pakyow/data/sources/relational/associations/has_many.rb', line 23 def type :has end |