public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fixed that that multiparameter assignment doesn't work with aggregations 
(closes #4620) [Lars Pind]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4188 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Thu Apr 06 09:16:29 -0700 2006
commit  8eb73f43e1f7eb6f7afa7838e64b259c81bc8a47
tree    2a00f89e62559f843786a9101016dbce1e1ed8b7
parent  64003677b7063aabc2a943e75e56b48cae6b15f7
...
 
 
1
2
3
 
4
5
6
...
1
2
3
4
 
5
6
7
8
0
@@ -1,6 +1,8 @@
0
+*1.14.1* (April 6th, 2005)
0
+
0
 * Fix type_name_with_module to handle type names that begin with '::'. Closes #4614. [Nicholas Seckar]
0
 
0
-*1.14.1* (April 6th, 2005)
0
+* Fixed that that multiparameter assignment doesn't work with aggregations (closes #4620) [Lars Pind]
0
 
0
 * Enable Limit/Offset in Calculations (closes #4558) [lmarlow@yahoo.com]
0
 
...
1988
1989
1990
1991
 
1992
1993
1994
...
1988
1989
1990
 
1991
1992
1993
1994
0
@@ -1988,7 +1988,7 @@
0
       def execute_callstack_for_multiparameter_attributes(callstack)
0
         errors = []
0
         callstack.each do |name, values|
0
- klass = (self.class.reflect_on_aggregation(name) || column_for_attribute(name)).klass
0
+ klass = (self.class.reflect_on_aggregation(name.to_sym) || column_for_attribute(name)).klass
0
           if values.empty?
0
             send(name + "=", nil)
0
           else
...
2
3
4
 
5
6
7
...
720
721
722
 
 
 
 
 
 
 
 
723
724
725
...
2
3
4
5
6
7
8
...
721
722
723
724
725
726
727
728
729
730
731
732
733
734
0
@@ -2,6 +2,7 @@
0
 require 'fixtures/topic'
0
 require 'fixtures/reply'
0
 require 'fixtures/company'
0
+require 'fixtures/customer'
0
 require 'fixtures/developer'
0
 require 'fixtures/project'
0
 require 'fixtures/default'
0
@@ -720,6 +721,14 @@
0
     attributes = { "starting(1i)" => "2004", "starting(2i)" => "6", "starting(3i)" => "24" }
0
     task.attributes = attributes
0
     assert_equal time, task.starting
0
+ end
0
+
0
+ def test_multiparameter_assignment_of_aggregation
0
+ customer = Customer.new
0
+ address = Address.new("The Street", "The City", "The Country")
0
+ attributes = { "address(1)" => address.street, "address(2)" => address.city, "address(3)" => address.country }
0
+ customer.attributes = attributes
0
+ assert_equal address, customer.address
0
   end
0
 
0
   def test_attributes_on_dummy_time
...
14
15
16
 
 
 
 
17
18
19
...
14
15
16
17
18
19
20
21
22
23
0
@@ -14,6 +14,10 @@
0
   def close_to?(other_address)
0
     city == other_address.city && country == other_address.country
0
   end
0
+
0
+ def ==(other)
0
+ other.is_a?(self.class) && other.street == street && other.city == city && other.country == country
0
+ end
0
 end
0
 
0
 class Money

Comments

    No one has commented yet.