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.
138 139 140 |
# File 'lib/postgres_ext/active_record/relation/query_methods.rb', line 138 def initialize(scope) @scope = scope end |
Instance Method Details
#recursive(*args) ⇒ Object
Returns a new relation expressing WITH RECURSIVE
143 144 145 146 147 |
# File 'lib/postgres_ext/active_record/relation/query_methods.rb', line 143 def recursive(*args) @scope.with_values += args @scope.recursive_value = true @scope end |