Class: BabySqueel::Nodes::Attribute
Instance Method Summary collapse
- #_arel ⇒ Object
- #in(rel) ⇒ Object
-
#initialize(parent, name) ⇒ Attribute
constructor
A new instance of Attribute.
Methods included from Operators::ArelAliasing
Methods included from Operators::Generic
Methods inherited from Proxy
Constructor Details
#initialize(parent, name) ⇒ Attribute
Returns a new instance of Attribute.
73 74 75 76 77 |
# File 'lib/baby_squeel/nodes.rb', line 73 def initialize(parent, name) @parent = parent @name = name super(parent._table[name]) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BabySqueel::Nodes::Proxy
Instance Method Details
#_arel ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/baby_squeel/nodes.rb', line 87 def _arel parent_arel = @parent._arel if parent_arel && parent_arel.last parent_arel.last.left[@name] else super end end |
#in(rel) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/baby_squeel/nodes.rb', line 79 def in(rel) if rel.is_a? ::ActiveRecord::Relation ::Arel::Nodes::In.new(self, Arel.sql(rel.to_sql)) else super end end |