Skip to content

Commit 0517474

Browse files
committed
Merge pull request rails#6743 from steveklabnik/remove_composed_of
Removing composed_of
2 parents fda195d + 14fc8b3 commit 0517474

18 files changed

+9
-768
lines changed

activerecord/README.rdoc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,6 @@ A short rundown of some of the major features:
4646
{Learn more}[link:classes/ActiveRecord/Associations/ClassMethods.html]
4747

4848

49-
* Aggregations of value objects.
50-
51-
class Account < ActiveRecord::Base
52-
composed_of :balance, :class_name => "Money",
53-
:mapping => %w(balance amount)
54-
composed_of :address,
55-
:mapping => [%w(address_street street), %w(address_city city)]
56-
end
57-
58-
{Learn more}[link:classes/ActiveRecord/Aggregations/ClassMethods.html]
59-
60-
6149
* Validation rules that can differ for new or existing objects.
6250

6351
class Account < ActiveRecord::Base

activerecord/lib/active_record.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ module ActiveRecord
3636
autoload :ConnectionNotEstablished, 'active_record/errors'
3737
autoload :ConnectionAdapters, 'active_record/connection_adapters/abstract_adapter'
3838

39-
autoload :Aggregations
4039
autoload :Associations
4140
autoload :AttributeMethods
4241
autoload :AttributeAssignment

activerecord/lib/active_record/aggregations.rb

Lines changed: 0 additions & 261 deletions
This file was deleted.

activerecord/lib/active_record/attribute_assignment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def mass_assignment_role
132132
private
133133

134134
# Instantiates objects for all attribute classes that needs more than one constructor parameter. This is done
135-
# by calling new on the column type or aggregation type (through composed_of) object with these parameters.
135+
# by calling new on the column type or aggregation type object with these parameters.
136136
# So having the pairs written_on(1) = "2004", written_on(2) = "6", written_on(3) = "24", will instantiate
137137
# written_on (a date type) with Date.new("2004", "6", "24"). You can also specify a typecast character in the
138138
# parentheses to have the parameters typecasted before they're used in the constructor. Use i for Fixnum,
@@ -167,7 +167,7 @@ def execute_callstack_for_multiparameter_attributes(callstack)
167167
end
168168

169169
def read_value_from_parameter(name, values_hash_from_param)
170-
klass = (self.class.reflect_on_aggregation(name.to_sym) || column_for_attribute(name)).klass
170+
klass = column_for_attribute(name).klass
171171
if values_hash_from_param.values.all?{|v|v.nil?}
172172
nil
173173
elsif klass == Time

activerecord/lib/active_record/core.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ def initialize_dup(other) # :nodoc:
266266
@changed_attributes[attr] = orig_value if _field_changed?(attr, orig_value, @attributes[attr])
267267
end
268268

269-
@aggregation_cache = {}
270269
@association_cache = {}
271270
@attributes_cache = {}
272271

@@ -391,7 +390,6 @@ def init_internals
391390

392391
@attributes[pk] = nil unless @attributes.key?(pk)
393392

394-
@aggregation_cache = {}
395393
@association_cache = {}
396394
@attributes_cache = {}
397395
@previously_changed = {}

activerecord/lib/active_record/dynamic_matchers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def initialize(model, name)
5656
end
5757

5858
def valid?
59-
attribute_names.all? { |name| model.columns_hash[name] || model.reflect_on_aggregation(name.to_sym) }
59+
attribute_names.all? { |name| model.columns_hash[name] }
6060
end
6161

6262
def define

activerecord/lib/active_record/model.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def self.append_features(base)
8989
include ActiveModel::SecurePassword
9090
include AutosaveAssociation
9191
include NestedAttributes
92-
include Aggregations
9392
include Transactions
9493
include Reflection
9594
include Serialization

activerecord/lib/active_record/persistence.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ def toggle!(attribute)
267267
# may do e.g. record.reload(:lock => true) to reload the same record with
268268
# an exclusive row lock.
269269
def reload(options = nil)
270-
clear_aggregation_cache
271270
clear_association_cache
272271

273272
fresh_object =

0 commit comments

Comments
 (0)