Class: ActiveRecord::Associations::JoinDependency::Aliases
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/associations/join_dependency.rb
Overview
:nodoc:
Defined Under Namespace
Instance Method Summary collapse
- #column_alias(node, column) ⇒ Object
- #column_aliases(node) ⇒ Object
- #columns ⇒ Object
-
#initialize(tables) ⇒ Aliases
constructor
A new instance of Aliases.
Constructor Details
#initialize(tables) ⇒ Aliases
Returns a new instance of Aliases.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/associations/join_dependency.rb', line 14 def initialize(tables) @tables = tables @alias_cache = tables.each_with_object({}) { |table, h| h[table.node] = table.columns.each_with_object({}) { |column, i| i[column.name] = column.alias } } @columns_cache = tables.each_with_object({}) { |table, h| h[table.node] = table.columns } end |
Instance Method Details
#column_alias(node, column) ⇒ Object
34 35 36 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/associations/join_dependency.rb', line 34 def column_alias(node, column) @alias_cache[node][column] end |
#column_aliases(node) ⇒ Object
30 31 32 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/associations/join_dependency.rb', line 30 def column_aliases(node) @columns_cache[node] end |
#columns ⇒ Object
26 27 28 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/associations/join_dependency.rb', line 26 def columns @tables.flat_map(&:column_aliases) end |