method

expand_hash_conditions_for_aggregates

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ClassMethods

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v5.2.3) is shown here.

expand_hash_conditions_for_aggregates(attrs) private

Accepts a hash of SQL conditions and replaces those attributes that correspond to a {#composed_of}[rdoc-ref:Aggregations::ClassMethods#composed_of] relationship with their expanded aggregate attribute values.

Given:

class Person < ActiveRecord::Base
  composed_of :address, class_name: "Address",
    mapping: [%w(address_street street), %w(address_city city)]
end

Then:

{ address: Address.new("813 abc st.", "chicago") }
# => { address_street: "813 abc st.", address_city: "chicago" }
Show source
Register or log in to add new notes.