activerecord 4.0.12 → 4.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f92d690d5f700414667a3ee964fa07c9450a28f5
4
- data.tar.gz: 99d48225fd95241ad663b52d5166ff6a4bfac11a
3
+ metadata.gz: 2ba363d6a3bc9185c6e4676cd69a0c8af08051cd
4
+ data.tar.gz: bddcbc3eeff462cda0c439f19d3439bbf5c4c0be
5
5
  SHA512:
6
- metadata.gz: 0aeab78fd21761559a864f656cdb6379194ee4a9c4270bb9d24e4173db385ce5e3a1e7a2c5ca305964668c03c488e3a098720617d755bc1780cfd27620647502
7
- data.tar.gz: 9576950f6c1e57124ff8002e335051d52b5cc71afe197120a95247e86c9bdbcfbec96a3c7193f17d7892d002b18a58c81e9cd154fd9bc72b3c521add990eec45
6
+ metadata.gz: 26c568021fccd2ab9d463e1752b9fb42753ec6ea938cdaf6e39aa654acaa98ab15db1d7852dda87af852601dc9d676eacb5059fd1ee337de4dc76273cf89e971
7
+ data.tar.gz: c6aeece39dcfb73d89740d7bd64210f927bad042db1832cdacf975ae101fb68d128875bf1a38a896cc430ee36ffe3c41973dbe97b65c281d45ffbf1e1fe1b4aa
@@ -1,3 +1,40 @@
1
+ * Renaming a table in pg also renames the primary key index.
2
+
3
+ Fixes #12856
4
+
5
+ *Sean Griffin*
6
+
7
+ * Make it possible to access fixtures excluded by a `default_scope`.
8
+
9
+ *Yves Senn*
10
+
11
+ * `timestamps` and `add_timestamps` passes additional options along.
12
+ (like `null: false`)
13
+
14
+ Closes #17624.
15
+
16
+ *Yves Senn*
17
+
18
+
19
+ ## Rails 4.0.12 (November 16, 2014) ##
20
+
21
+ * Cache `CollectionAssociation#reader` proxies separately before and after
22
+ the owner has been saved so that the proxy is not cached without the
23
+ owner's id.
24
+
25
+ *Ben Woosley*
26
+
27
+
28
+ ## Rails 4.0.11.1 (November 19, 2014) ##
29
+
30
+ *No changes*
31
+
32
+
33
+ ## Rails 4.0.11 (September 11, 2014) ##
34
+
35
+ *No changes*
36
+
37
+
1
38
  ## Rails 4.0.10 (September 11, 2014) ##
2
39
 
3
40
  * Fixed a regression where whitespaces were stripped from DISTINCT queries in
@@ -34,7 +34,13 @@ module ActiveRecord
34
34
  reload
35
35
  end
36
36
 
37
- @proxy ||= CollectionProxy.new(klass, self)
37
+ if owner.new_record?
38
+ # Cache the proxy separately before the owner has an id
39
+ # or else a post-save proxy will still lack the id
40
+ @new_record_proxy ||= CollectionProxy.new(klass, self)
41
+ else
42
+ @proxy ||= CollectionProxy.new(klass, self)
43
+ end
38
44
  end
39
45
 
40
46
  # Implements the writer method, e.g. foo.items= for Foo.has_many :items
@@ -34,7 +34,7 @@ module ActiveRecord
34
34
  if create_time_zone_conversion_attribute?(attr_name, columns_hash[attr_name])
35
35
  method_body, line = <<-EOV, __LINE__ + 1
36
36
  def #{attr_name}=(time)
37
- time_with_zone = time.respond_to?(:in_time_zone) ? time.in_time_zone : nil
37
+ time_with_zone = convert_value_to_time_zone(time)
38
38
  previous_time = attribute_changed?("#{attr_name}") ? changed_attributes["#{attr_name}"] : read_attribute(:#{attr_name})
39
39
  write_attribute(:#{attr_name}, time)
40
40
  #{attr_name}_will_change! if previous_time != time_with_zone
@@ -54,6 +54,18 @@ module ActiveRecord
54
54
  (:datetime == column.type || :timestamp == column.type)
55
55
  end
56
56
  end
57
+
58
+ private
59
+
60
+ def convert_value_to_time_zone(value)
61
+ if value.is_a?(Array)
62
+ value.map { |v| convert_value_to_time_zone(v) }
63
+ elsif value.respond_to?(:in_time_zone)
64
+ value.in_time_zone
65
+ else
66
+ nil
67
+ end
68
+ end
57
69
  end
58
70
  end
59
71
  end
@@ -393,8 +393,8 @@ module ActiveRecord
393
393
  # Adds timestamps (+created_at+ and +updated_at+) columns to the table. See SchemaStatements#add_timestamps
394
394
  #
395
395
  # t.timestamps
396
- def timestamps
397
- @base.add_timestamps(@table_name)
396
+ def timestamps(options = {})
397
+ @base.add_timestamps(@table_name, options)
398
398
  end
399
399
 
400
400
  # Changes the column's definition according to the new options.
@@ -727,9 +727,9 @@ module ActiveRecord
727
727
  #
728
728
  # add_timestamps(:suppliers)
729
729
  #
730
- def add_timestamps(table_name)
731
- add_column table_name, :created_at, :datetime
732
- add_column table_name, :updated_at, :datetime
730
+ def add_timestamps(table_name, options = {})
731
+ add_column table_name, :created_at, :datetime, options
732
+ add_column table_name, :updated_at, :datetime, options
733
733
  end
734
734
 
735
735
  # Removes the timestamp columns (+created_at+ and +updated_at+) from the table definition.
@@ -721,8 +721,8 @@ module ActiveRecord
721
721
  "DROP INDEX #{index_name}"
722
722
  end
723
723
 
724
- def add_timestamps_sql(table_name)
725
- [add_column_sql(table_name, :created_at, :datetime), add_column_sql(table_name, :updated_at, :datetime)]
724
+ def add_timestamps_sql(table_name, options = {})
725
+ [add_column_sql(table_name, :created_at, :datetime, options), add_column_sql(table_name, :updated_at, :datetime, options)]
726
726
  end
727
727
 
728
728
  def remove_timestamps_sql(table_name)
@@ -382,7 +382,10 @@ module ActiveRecord
382
382
  pk, seq = pk_and_sequence_for(new_name)
383
383
  if seq == "#{table_name}_#{pk}_seq"
384
384
  new_seq = "#{new_name}_#{pk}_seq"
385
+ idx = "#{table_name}_pkey"
386
+ new_idx = "#{new_name}_pkey"
385
387
  execute "ALTER TABLE #{quote_table_name(seq)} RENAME TO #{quote_table_name(new_seq)}"
388
+ execute "ALTER INDEX #{quote_table_name(idx)} RENAME TO #{quote_table_name(new_idx)}"
386
389
  end
387
390
 
388
391
  rename_table_indexes(table_name, new_name)
@@ -696,7 +696,7 @@ module ActiveRecord
696
696
 
697
697
  def find
698
698
  if model_class
699
- model_class.find(fixture[model_class.primary_key])
699
+ model_class.unscoped.find(fixture[model_class.primary_key])
700
700
  else
701
701
  raise FixtureClassNotFound, "No class attached to find."
702
702
  end
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  # Returns the version of the currently loaded ActiveRecord as a Gem::Version
3
3
  def self.version
4
- Gem::Version.new "4.0.12"
4
+ Gem::Version.new "4.0.13.rc1"
5
5
  end
6
6
 
7
7
  module VERSION #:nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.12
4
+ version: 4.0.13.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-16 00:00:00.000000000 Z
11
+ date: 2015-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.12
19
+ version: 4.0.13.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.12
26
+ version: 4.0.13.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.12
33
+ version: 4.0.13.rc1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.12
40
+ version: 4.0.13.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: arel
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -255,12 +255,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
255
  version: 1.9.3
256
256
  required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  requirements:
258
- - - ">="
258
+ - - ">"
259
259
  - !ruby/object:Gem::Version
260
- version: '0'
260
+ version: 1.3.1
261
261
  requirements: []
262
262
  rubyforge_project:
263
- rubygems_version: 2.4.2
263
+ rubygems_version: 2.4.5
264
264
  signing_key:
265
265
  specification_version: 4
266
266
  summary: Object-relational mapper framework (part of Rails).