Class: ActiveRecord::Embedded::Aggregation::Postgresql
- Inherits:
-
ActiveRecord::Embedded::Aggregation
- Object
- ActiveRecord::Embedded::Aggregation
- ActiveRecord::Embedded::Aggregation::Postgresql
- Defined in:
- lib/active_record/embedded/aggregation/postgresql.rb
Overview
Driver for JSON/JSONB query support in PostgreSQL. Uses a @> query to look for partial JSON in the data
Array.
Instance Method Summary collapse
Methods inherited from ActiveRecord::Embedded::Aggregation
Methods included from Interface
Methods included from Query
#build, #create, #create!, #find, #find!, #find_by, #find_by!, #initialize, #inspect, #limit, #offset, #order, #where
Constructor Details
This class inherits a constructor from ActiveRecord::Embedded::Aggregation
Instance Method Details
#results ⇒ Object
11 12 13 14 15 16 |
# File 'lib/active_record/embedded/aggregation/postgresql.rb', line 11 def results criteria = parent.where("#{as} @> ?", params) criteria = criteria.offset(from) unless from.zero? criteria = criteria.limit(to) unless to == -1 criteria.map { |record| [record, query_for(record)] } end |