expand_hash_conditions_for_aggregates

expand_hash_conditions_for_aggregates(attrs)
Instance Protected methods

Accepts a hash of SQL conditions and replaces those attributes that correspond to a composed_of relationship with their expanded aggregate attribute values. Given:

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

Then:

1
2
{ address: Address.new("813 abc st.", "chicago") }
  # => { address_street: "813 abc st.", address_city: "chicago" }
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.