Module: Hoardable::ArelVisitors
- Defined in:
- lib/hoardable/arel_visitors.rb
Overview
This is a monkey patch of JOIN related Arel::Visitors for PostgreSQL so that they can append the ONLY clause when known to be operating on a Model. Ideally, Arel itself would provide a mechanism to support this keyword.
Instance Method Summary collapse
- #visit_Arel_Nodes_FullOuterJoin(o, collector) ⇒ Object
- #visit_Arel_Nodes_InnerJoin(o, collector) ⇒ Object
- #visit_Arel_Nodes_OuterJoin(o, collector) ⇒ Object
- #visit_Arel_Nodes_RightOuterJoin(o, collector) ⇒ Object
Instance Method Details
#visit_Arel_Nodes_FullOuterJoin(o, collector) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/hoardable/arel_visitors.rb', line 6 def visit_Arel_Nodes_FullOuterJoin(o, collector) collector << "FULL OUTER JOIN " hoardable_maybe_add_only(o, collector) collector = visit o.left, collector collector << " " visit o.right, collector end |
#visit_Arel_Nodes_InnerJoin(o, collector) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/hoardable/arel_visitors.rb', line 30 def visit_Arel_Nodes_InnerJoin(o, collector) collector << "INNER JOIN " hoardable_maybe_add_only(o, collector) collector = visit o.left, collector if o.right collector << " " visit(o.right, collector) else collector end end |
#visit_Arel_Nodes_OuterJoin(o, collector) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/hoardable/arel_visitors.rb', line 14 def visit_Arel_Nodes_OuterJoin(o, collector) collector << "LEFT OUTER JOIN " hoardable_maybe_add_only(o, collector) collector = visit o.left, collector collector << " " visit o.right, collector end |
#visit_Arel_Nodes_RightOuterJoin(o, collector) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/hoardable/arel_visitors.rb', line 22 def visit_Arel_Nodes_RightOuterJoin(o, collector) collector << "RIGHT OUTER JOIN " hoardable_maybe_add_only(o, collector) collector = visit o.left, collector collector << " " visit o.right, collector end |