Class: ActiveRecord::QueryMethods::WithChain
- Inherits:
-
Object
- Object
- ActiveRecord::QueryMethods::WithChain
- Defined in:
- lib/postgres_ext/active_record/relation/query_methods.rb
Overview
WithChain objects act as placeholder for queries in which #with does not have any parameter. In this case, #with must be chained with #recursive to return a new relation.
Instance Method Summary collapse
-
#initialize(scope) ⇒ WithChain
constructor
A new instance of WithChain.
-
#recursive(*args) ⇒ Object
Returns a new relation expressing WITH RECURSIVE.
Constructor Details
#initialize(scope) ⇒ WithChain
Returns a new instance of WithChain.
118 119 120 |
# File 'lib/postgres_ext/active_record/relation/query_methods.rb', line 118 def initialize(scope) @scope = scope end |
Instance Method Details
#recursive(*args) ⇒ Object
Returns a new relation expressing WITH RECURSIVE
123 124 125 126 127 |
# File 'lib/postgres_ext/active_record/relation/query_methods.rb', line 123 def recursive(*args) @scope.with_values += args @scope.recursive_value = true @scope end |