activerecord 3.0.12 → 3.0.13.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activerecord might be problematic. Click here for more details.

@@ -48,7 +48,7 @@ module ActiveRecord
48
48
  #
49
49
  # def <=>(other_money)
50
50
  # if currency == other_money.currency
51
- # amount <=> amount
51
+ # amount <=> other_money.amount
52
52
  # else
53
53
  # amount <=> other_money.exchange_to(currency).amount
54
54
  # end
@@ -140,6 +140,23 @@ module ActiveRecord
140
140
  CODE
141
141
  end
142
142
 
143
+ def define_non_cyclic_method(name, reflection, &block)
144
+ define_method(name) do |*args|
145
+ result = true; @_already_called ||= {}
146
+ # Loop prevention for validation of associations
147
+ unless @_already_called[[name, reflection.name]]
148
+ begin
149
+ @_already_called[[name, reflection.name]]=true
150
+ result = instance_eval(&block)
151
+ ensure
152
+ @_already_called[[name, reflection.name]]=false
153
+ end
154
+ end
155
+
156
+ result
157
+ end
158
+ end
159
+
143
160
  # Adds validation and save callbacks for the association as specified by
144
161
  # the +reflection+.
145
162
  #
@@ -169,7 +186,7 @@ module ActiveRecord
169
186
  define_method(save_method) { save_has_one_association(reflection) }
170
187
  after_save save_method
171
188
  else
172
- define_method(save_method) { save_belongs_to_association(reflection) }
189
+ define_non_cyclic_method(save_method, reflection) { save_belongs_to_association(reflection) }
173
190
  before_save save_method
174
191
  end
175
192
  end
@@ -40,7 +40,7 @@ module ActiveRecord
40
40
  def header(stream)
41
41
  define_params = @version ? ":version => #{@version}" : ""
42
42
 
43
- if stream.respond_to?(:external_encoding)
43
+ if stream.respond_to?(:external_encoding) && stream.external_encoding
44
44
  stream.puts "# encoding: #{stream.external_encoding.name}"
45
45
  end
46
46
 
@@ -2,8 +2,8 @@ module ActiveRecord
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 12
6
- PRE = nil
5
+ TINY = 13
6
+ PRE = "rc1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
4
+ hash: -791037378
5
+ prerelease: 7
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 12
10
- version: 3.0.12
9
+ - 13
10
+ - rc
11
+ - 1
12
+ version: 3.0.13.rc1
11
13
  platform: ruby
12
14
  authors:
13
15
  - David Heinemeier Hansson
@@ -15,7 +17,7 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2012-03-01 00:00:00 Z
20
+ date: 2012-05-28 00:00:00 Z
19
21
  dependencies:
20
22
  - !ruby/object:Gem::Dependency
21
23
  name: activesupport
@@ -25,12 +27,14 @@ dependencies:
25
27
  requirements:
26
28
  - - "="
27
29
  - !ruby/object:Gem::Version
28
- hash: 31
30
+ hash: -791037378
29
31
  segments:
30
32
  - 3
31
33
  - 0
32
- - 12
33
- version: 3.0.12
34
+ - 13
35
+ - rc
36
+ - 1
37
+ version: 3.0.13.rc1
34
38
  type: :runtime
35
39
  version_requirements: *id001
36
40
  - !ruby/object:Gem::Dependency
@@ -41,12 +45,14 @@ dependencies:
41
45
  requirements:
42
46
  - - "="
43
47
  - !ruby/object:Gem::Version
44
- hash: 31
48
+ hash: -791037378
45
49
  segments:
46
50
  - 3
47
51
  - 0
48
- - 12
49
- version: 3.0.12
52
+ - 13
53
+ - rc
54
+ - 1
55
+ version: 3.0.13.rc1
50
56
  type: :runtime
51
57
  version_requirements: *id002
52
58
  - !ruby/object:Gem::Dependency
@@ -207,16 +213,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
213
  required_rubygems_version: !ruby/object:Gem::Requirement
208
214
  none: false
209
215
  requirements:
210
- - - ">="
216
+ - - ">"
211
217
  - !ruby/object:Gem::Version
212
- hash: 3
218
+ hash: 25
213
219
  segments:
214
- - 0
215
- version: "0"
220
+ - 1
221
+ - 3
222
+ - 1
223
+ version: 1.3.1
216
224
  requirements: []
217
225
 
218
226
  rubyforge_project: activerecord
219
- rubygems_version: 1.8.16
227
+ rubygems_version: 1.8.22
220
228
  signing_key:
221
229
  specification_version: 3
222
230
  summary: Object-relational mapper framework (part of Rails).