Module: Squeel::Adapters::ActiveRecord::JoinDependencyExtensions
- Defined in:
- lib/squeel/adapters/active_record/join_dependency_extensions.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
13 14 15 16 17 |
# File 'lib/squeel/adapters/active_record/join_dependency_extensions.rb', line 13 def self.included(base) base.class_eval do alias_method_chain :build, :squeel end end |
Instance Method Details
#build_with_squeel(associations, parent = nil, join_type = InnerJoin) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/squeel/adapters/active_record/join_dependency_extensions.rb', line 19 def build_with_squeel(associations, parent = nil, join_type = InnerJoin) case associations when Nodes::Stub associations = associations.symbol when Nodes::Join associations = associations._join end if Nodes::KeyPath === associations parent ||= _join_parts.last associations.path.each do |key| parent = build(key, parent, join_type) end parent else build_without_squeel(associations, parent, join_type) end end |