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.
- #not_in(rel) ⇒ Object
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.to_s 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
28 29 30 31 32 33 34 |
# File 'lib/baby_squeel/nodes/attribute.rb', line 28 def _arel if @parent.kind_of? BabySqueel::Association @parent.find_alias[@name] 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 |
#not_in(rel) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/baby_squeel/nodes/attribute.rb', line 20 def not_in(rel) if rel.is_a? ::ActiveRecord::Relation ::Arel::Nodes::NotIn.new(self, Arel.sql(rel.to_sql)) else super end end |