Class: BabySqueel::Nodes::Attribute
- Defined in:
- lib/baby_squeel/nodes/attribute.rb
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
const_missing, #inspect, #respond_to?
Constructor Details
#initialize(parent, name) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 10 |
# File 'lib/baby_squeel/nodes/attribute.rb', line 6 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
20 21 22 23 24 25 26 27 |
# File 'lib/baby_squeel/nodes/attribute.rb', line 20 def _arel if @parent.kind_of? BabySqueel::Association table = @parent.find_alias(@parent) table ? table[@name] : super else super end end |
#in(rel) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/baby_squeel/nodes/attribute.rb', line 12 def in(rel) if rel.is_a? ::ActiveRecord::Relation ::Arel::Nodes::In.new(self, Arel.sql(rel.to_sql)) else super end end |