activerecord 3.2.4 → 3.2.5

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.

@@ -77,7 +77,7 @@ module ActiveRecord
77
77
  # Some databases impose a limit on the number of ids in a list (in Oracle it's 1000)
78
78
  # Make several smaller queries if necessary or make one query if the adapter supports it
79
79
  sliced = owner_keys.each_slice(model.connection.in_clause_length || owner_keys.size)
80
- records = sliced.map { |slice| records_for(slice).to_a }.flatten
80
+ records = sliced.map { |slice| records_for(slice) }.flatten
81
81
  end
82
82
 
83
83
  # Each record may have multiple owners, and vice-versa
@@ -93,8 +93,7 @@ module ActiveRecord
93
93
  end
94
94
 
95
95
  def build_scope
96
- scope = klass.unscoped
97
- scope.default_scoped = true
96
+ scope = klass.scoped
98
97
 
99
98
  scope = scope.where(process_conditions(options[:conditions]))
100
99
  scope = scope.where(process_conditions(preload_options[:conditions]))
@@ -58,12 +58,13 @@ module ActiveRecord
58
58
  self.serialized_attributes = serialized_attributes.merge(attr_name.to_s => coder)
59
59
  end
60
60
 
61
- def initialize_attributes(attributes) #:nodoc:
62
- super
61
+ def initialize_attributes(attributes, options = {}) #:nodoc:
62
+ serialized = (options.delete(:serialized) { true }) ? :serialized : :unserialized
63
+ super(attributes, options)
63
64
 
64
65
  serialized_attributes.each do |key, coder|
65
66
  if attributes.key?(key)
66
- attributes[key] = Attribute.new(coder, attributes[key], :serialized)
67
+ attributes[key] = Attribute.new(coder, attributes[key], serialized)
67
68
  end
68
69
  end
69
70
 
@@ -534,7 +534,7 @@ module ActiveRecord #:nodoc:
534
534
  # The dup method does not preserve the timestamps (created|updated)_(at|on).
535
535
  def initialize_dup(other)
536
536
  cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)
537
- self.class.initialize_attributes(cloned_attributes)
537
+ self.class.initialize_attributes(cloned_attributes, :serialized => false)
538
538
 
539
539
  cloned_attributes.delete(self.class.primary_key)
540
540
 
@@ -344,7 +344,8 @@ module ActiveRecord
344
344
 
345
345
  # Is this connection alive and ready for queries?
346
346
  def active?
347
- @connection.status == PGconn::CONNECTION_OK
347
+ @connection.query 'SELECT 1'
348
+ true
348
349
  rescue PGError
349
350
  false
350
351
  end
@@ -170,7 +170,7 @@ module ActiveRecord
170
170
  # start the lock version at zero. Note we can't use
171
171
  # <tt>locking_enabled?</tt> at this point as
172
172
  # <tt>@attributes</tt> may not have been initialized yet.
173
- def initialize_attributes(attributes) #:nodoc:
173
+ def initialize_attributes(attributes, options = {}) #:nodoc:
174
174
  if attributes.key?(locking_column) && lock_optimistically
175
175
  attributes[locking_column] ||= 0
176
176
  end
@@ -34,7 +34,7 @@ module ActiveRecord
34
34
  if current_scope
35
35
  current_scope.clone
36
36
  else
37
- scope = relation
37
+ scope = relation.clone
38
38
  scope.default_scoped = true
39
39
  scope
40
40
  end
@@ -48,7 +48,7 @@ module ActiveRecord
48
48
  if current_scope
49
49
  current_scope.scope_for_create
50
50
  else
51
- scope = relation
51
+ scope = relation.clone
52
52
  scope.default_scoped = true
53
53
  scope.scope_for_create
54
54
  end
@@ -2,7 +2,7 @@ module ActiveRecord
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- TINY = 4
5
+ TINY = 5
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 4
10
- version: 3.2.4
9
+ - 5
10
+ version: 3.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Heinemeier Hansson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-31 00:00:00 Z
18
+ date: 2012-06-01 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
@@ -25,12 +25,12 @@ dependencies:
25
25
  requirements:
26
26
  - - "="
27
27
  - !ruby/object:Gem::Version
28
- hash: 7
28
+ hash: 5
29
29
  segments:
30
30
  - 3
31
31
  - 2
32
- - 4
33
- version: 3.2.4
32
+ - 5
33
+ version: 3.2.5
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
@@ -41,12 +41,12 @@ dependencies:
41
41
  requirements:
42
42
  - - "="
43
43
  - !ruby/object:Gem::Version
44
- hash: 7
44
+ hash: 5
45
45
  segments:
46
46
  - 3
47
47
  - 2
48
- - 4
49
- version: 3.2.4
48
+ - 5
49
+ version: 3.2.5
50
50
  type: :runtime
51
51
  version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency