public
Fork of NZKoz/koz-rails
Description: Koz's rails git-svn clone
Homepage: http://www.rubyonrails.org
Clone URL: git://github.com/eventualbuddha/koz-rails.git
2-0-stable: Revert [8866]


git-svn-id: 
http://svn-commit.rubyonrails.org/rails/branches/2-0-stable@8947 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
nzkoz (author)
Thu Feb 28 20:36:54 -0800 2008
commit  d610c3e10a88d1d3afa29b7e655a6291468afbcc
tree    02b359ffc68b2ff6c220c6c45d5128596c2cbf5b
parent  a76085fdf6d29b498eed9478483fe9cf4155e63e
...
1
2
3
4
5
6
7
...
1
2
 
 
3
4
5
0
@@ -1,7 +1,5 @@
0
 *SVN*
0
 
0
-* Improve associations performance by avoiding named block arguments. #11109 [adymo]
0
-
0
 * Ensure that modifying has_and_belongs_to_many actions clear the query cache. Closes #10840 [john.andrews]
0
 
0
 * Fix issue where Table#references doesn't pass a :null option to a *_type attribute for polymorphic associations. Closes #10753 [railsjitsu]
...
43
44
45
46
47
 
 
48
49
50
...
121
122
123
124
 
125
126
 
127
128
129
...
157
158
159
160
 
161
162
 
163
164
165
166
 
167
168
169
...
189
190
191
192
 
193
194
195
 
196
197
198
 
199
200
 
201
202
203
...
43
44
45
 
 
46
47
48
49
50
...
121
122
123
 
124
125
 
126
127
128
129
...
157
158
159
 
160
161
 
162
163
 
 
 
164
165
166
167
...
187
188
189
 
190
191
192
 
193
194
195
 
196
197
 
198
199
200
201
0
@@ -43,8 +43,8 @@ module ActiveRecord
0
       end
0
 
0
       # Calculate sum using SQL, not Enumerable
0
- def sum(*args)
0
- calculate(:sum, *args) { |*block_args| yield(*block_args) if block_given? }
0
+ def sum(*args, &block)
0
+ calculate(:sum, *args, &block)
0
       end
0
 
0
       # Remove +records+ from this association. Does not destroy +records+.
0
@@ -121,9 +121,9 @@ module ActiveRecord
0
         size.zero?
0
       end
0
 
0
- def any?
0
+ def any?(&block)
0
         if block_given?
0
- method_missing(:any?) { |*block_args| yield(*block_args) if block_given? }
0
+ method_missing(:any?, &block)
0
         else
0
           !empty?
0
         end
0
@@ -157,13 +157,11 @@ module ActiveRecord
0
 
0
 
0
       protected
0
- def method_missing(method, *args)
0
+ def method_missing(method, *args, &block)
0
           if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method))
0
- super { |*block_args| yield(*block_args) if block_given? }
0
+ super
0
           else
0
- @reflection.klass.send(:with_scope, construct_scope) {
0
- @reflection.klass.send(method, *args) { |*block_args| yield(*block_args) if block_given? }
0
- }
0
+ @reflection.klass.send(:with_scope, construct_scope) { @reflection.klass.send(method, *args, &block) }
0
           end
0
         end
0
 
0
@@ -189,15 +187,15 @@ module ActiveRecord
0
 
0
       private
0
 
0
- def create_record(attrs)
0
+ def create_record(attrs, &block)
0
           ensure_owner_is_not_new
0
           record = @reflection.klass.send(:with_scope, :create => construct_scope[:create]) { @reflection.klass.new(attrs) }
0
- add_record_to_target_with_callbacks(record) { |*block_args| yield(*block_args) if block_given? }
0
+ add_record_to_target_with_callbacks(record, &block)
0
         end
0
 
0
- def build_record(attrs)
0
+ def build_record(attrs, &block)
0
           record = @reflection.klass.new(attrs)
0
- add_record_to_target_with_callbacks(record) { |*block_args| yield(*block_args) if block_given? }
0
+ add_record_to_target_with_callbacks(record, &block)
0
         end
0
 
0
         def add_record_to_target_with_callbacks(record)
...
78
79
80
81
82
83
84
85
86
87
88
89
...
126
127
128
129
 
130
131
 
132
133
134
...
78
79
80
 
 
 
 
 
 
81
82
83
...
120
121
122
 
123
124
 
125
126
127
128
0
@@ -78,12 +78,6 @@ module ActiveRecord
0
         @target.inspect
0
       end
0
 
0
- def to_xml(options={}, &block)
0
- if load_target
0
- @target.to_xml(options, &block)
0
- end
0
- end
0
-
0
       protected
0
         def dependent?
0
           @reflection.options[:dependent]
0
@@ -126,9 +120,9 @@ module ActiveRecord
0
         end
0
 
0
       private
0
- def method_missing(method, *args)
0
+ def method_missing(method, *args, &block)
0
           if load_target
0
- @target.send(method, *args) { |*block_args| yield(*block_args) if block_given? }
0
+ @target.send(method, *args, &block)
0
           end
0
         end
0
 
...
113
114
115
116
117
 
 
118
119
120
...
128
129
130
131
 
132
133
 
134
135
136
137
 
138
139
140
...
113
114
115
 
 
116
117
118
119
120
...
128
129
130
 
131
132
 
133
134
 
 
 
135
136
137
138
0
@@ -113,8 +113,8 @@ module ActiveRecord
0
       end
0
 
0
       # Calculate sum using SQL, not Enumerable
0
- def sum(*args)
0
- calculate(:sum, *args) { |*block_args| yield(*block_args) if block_given? }
0
+ def sum(*args, &block)
0
+ calculate(:sum, *args, &block)
0
       end
0
       
0
       def count(*args)
0
@@ -128,13 +128,11 @@ module ActiveRecord
0
       end
0
 
0
       protected
0
- def method_missing(method, *args)
0
+ def method_missing(method, *args, &block)
0
           if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method))
0
- super { |*block_args| yield(*block_args) if block_given? }
0
+ super
0
           else
0
- @reflection.klass.send(:with_scope, construct_scope) {
0
- @reflection.klass.send(method, *args) { |*block_args| yield(*block_args) if block_given? }
0
- }
0
+ @reflection.klass.send(:with_scope, construct_scope) { @reflection.klass.send(method, *args, &block) }
0
           end
0
         end
0
 

Comments

    No one has commented yet.