activerecord 4.2.0.rc1 → 4.2.0.rc2

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: e36df2e99fc4c9ad7289fa8fd6a11f85a5933267
4
- data.tar.gz: 181f2f79748d0e92fb6a0e3c253dce3d08332577
3
+ metadata.gz: 28b61291529e1647dc68f482c67cb982f1412b58
4
+ data.tar.gz: 5d284927108612f0bba531978c77f77ecb2ab173
5
5
  SHA512:
6
- metadata.gz: 2450da5cfc14bdaea3914cb83a0f53193b26eb6600b1de7353901ba92edf085ff1437f970f6546b1701e28ba5f369747315e75a9692be14dccd6169f273ade26
7
- data.tar.gz: 082d7b0fc38bbea2ba4591d8d14c2ac196de1c057e5710e6fac6e286c6e5ab494b760de8563f0570ee3daae96ef8274cd0e1c7fd7430c7c3cf3d630e6482c447
6
+ metadata.gz: 53fae71b52ab612485bba69f354387d78b0a79cd5358488c3322f6e6efe38812b3467f903ba2b71c87774d7922a40935b8cd7a457423ec827cf288669a752fa7
7
+ data.tar.gz: bb77f7468870ad4497ddc1f42cf0a85ef38036a60297a80af4c506899fb28aa124cb87cc679b70d1bfd73d23e87791f1c03729a7bbc0b2e011707d4ba22db6cb
@@ -1,3 +1,8 @@
1
+ * `add_timestamps` and `remove_timestamps` now properly reversible with
2
+ options.
3
+
4
+ *Noam Gagliardi-Rabinovich*
5
+
1
6
  * Bring back `db:test:prepare` to synchronize the test database schema.
2
7
 
3
8
  Manual synchronization using `bin/rake db:test:prepare` is required
@@ -192,7 +192,7 @@ The latest version of Active Record can be installed with RubyGems:
192
192
 
193
193
  Source code can be downloaded as part of the Rails project on GitHub:
194
194
 
195
- * https://github.com/rails/rails/tree/master/activerecord
195
+ * https://github.com/rails/rails/tree/4-2-stable/activerecord
196
196
 
197
197
 
198
198
  == License
@@ -69,6 +69,11 @@ module ActiveRecord
69
69
  end
70
70
  end
71
71
 
72
+ def attribute_changed_in_place?(attr_name)
73
+ old_value = original_raw_attribute(attr_name)
74
+ @attributes[attr_name].changed_in_place_from?(old_value)
75
+ end
76
+
72
77
  private
73
78
 
74
79
  def calculate_changes_from_defaults
@@ -141,15 +146,10 @@ module ActiveRecord
141
146
 
142
147
  def changed_in_place
143
148
  self.class.attribute_names.select do |attr_name|
144
- changed_in_place?(attr_name)
149
+ attribute_changed_in_place?(attr_name)
145
150
  end
146
151
  end
147
152
 
148
- def changed_in_place?(attr_name)
149
- old_value = original_raw_attribute(attr_name)
150
- @attributes[attr_name].changed_in_place_from?(old_value)
151
- end
152
-
153
153
  def original_raw_attribute(attr_name)
154
154
  original_raw_attributes.fetch(attr_name) do
155
155
  read_attribute_before_type_cast(attr_name)
@@ -509,8 +509,8 @@ module ActiveRecord
509
509
  # Removes the timestamp columns (+created_at+ and +updated_at+) from the table.
510
510
  #
511
511
  # t.remove_timestamps
512
- def remove_timestamps
513
- @base.remove_timestamps(name)
512
+ def remove_timestamps(options = {})
513
+ @base.remove_timestamps(name, options)
514
514
  end
515
515
 
516
516
  # Renames a column.
@@ -854,7 +854,7 @@ module ActiveRecord
854
854
  #
855
855
  # remove_timestamps(:suppliers)
856
856
  #
857
- def remove_timestamps(table_name)
857
+ def remove_timestamps(table_name, options = {})
858
858
  remove_column table_name, :updated_at
859
859
  remove_column table_name, :created_at
860
860
  end
@@ -779,7 +779,7 @@ module ActiveRecord
779
779
  [add_column_sql(table_name, :created_at, :datetime, options), add_column_sql(table_name, :updated_at, :datetime, options)]
780
780
  end
781
781
 
782
- def remove_timestamps_sql(table_name)
782
+ def remove_timestamps_sql(table_name, options = {})
783
783
  [remove_column_sql(table_name, :updated_at), remove_column_sql(table_name, :created_at)]
784
784
  end
785
785
 
@@ -39,14 +39,14 @@ module ActiveRecord
39
39
  end
40
40
 
41
41
  def register_array_type(row)
42
- if subtype = @store.lookup(row['typelem'].to_i)
43
- register row['oid'], OID::Array.new(subtype, row['typdelim'])
42
+ register_with_subtype(row['oid'], row['typelem'].to_i) do |subtype|
43
+ OID::Array.new(subtype, row['typdelim'])
44
44
  end
45
45
  end
46
46
 
47
47
  def register_range_type(row)
48
- if subtype = @store.lookup(row['rngsubtype'].to_i)
49
- register row['oid'], OID::Range.new(subtype, row['typname'].to_sym)
48
+ register_with_subtype(row['oid'], row['rngsubtype'].to_i) do |subtype|
49
+ OID::Range.new(subtype, row['typname'].to_sym)
50
50
  end
51
51
  end
52
52
 
@@ -64,9 +64,13 @@ module ActiveRecord
64
64
  end
65
65
  end
66
66
 
67
- def register(oid, oid_type)
68
- oid = assert_valid_registration(oid, oid_type)
69
- @store.register_type(oid, oid_type)
67
+ def register(oid, oid_type = nil, &block)
68
+ oid = assert_valid_registration(oid, oid_type || block)
69
+ if block_given?
70
+ @store.register_type(oid, &block)
71
+ else
72
+ @store.register_type(oid, oid_type)
73
+ end
70
74
  end
71
75
 
72
76
  def alias_type(oid, target)
@@ -74,6 +78,14 @@ module ActiveRecord
74
78
  @store.alias_type(oid, target)
75
79
  end
76
80
 
81
+ def register_with_subtype(oid, target_oid)
82
+ if @store.key?(target_oid)
83
+ register(oid) do |_, *args|
84
+ yield @store.lookup(target_oid, *args)
85
+ end
86
+ end
87
+ end
88
+
77
89
  def assert_valid_registration(oid, oid_type)
78
90
  raise ArgumentError, "can't register nil type for OID #{oid}" if oid_type.nil?
79
91
  oid.to_i
@@ -516,9 +516,12 @@ module ActiveRecord
516
516
 
517
517
  def extract_limit(sql_type) # :nodoc:
518
518
  case sql_type
519
- when /^bigint/i; 8
520
- when /^smallint/i; 2
521
- else super
519
+ when /^bigint/i, /^int8/i
520
+ 8
521
+ when /^smallint/i
522
+ 2
523
+ else
524
+ super
522
525
  end
523
526
  end
524
527
 
@@ -532,7 +535,7 @@ module ActiveRecord
532
535
  when 'true', 'false'
533
536
  default
534
537
  # Numeric types
535
- when /\A\(?(-?\d+(\.\d*)?\)?(::bigint)?)\z/
538
+ when /\A\(?(-?\d+(\.\d*)?)\)?(::bigint)?\z/
536
539
  $1
537
540
  # Object identifier types
538
541
  when /\A-?\d+\z/
@@ -85,7 +85,6 @@ module ActiveRecord
85
85
  mattr_accessor :dump_schema_after_migration, instance_writer: false
86
86
  self.dump_schema_after_migration = true
87
87
 
88
- # :nodoc:
89
88
  mattr_accessor :maintain_test_schema, instance_accessor: false
90
89
 
91
90
  def self.disable_implicit_join_references=(value)
@@ -8,7 +8,7 @@ module ActiveRecord
8
8
  MAJOR = 4
9
9
  MINOR = 2
10
10
  TINY = 0
11
- PRE = "rc1"
11
+ PRE = "rc2"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
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.2.0.rc1
4
+ version: 4.2.0.rc2
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-28 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0.rc1
19
+ version: 4.2.0.rc2
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.2.0.rc1
26
+ version: 4.2.0.rc2
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.2.0.rc1
33
+ version: 4.2.0.rc2
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.2.0.rc1
40
+ version: 4.2.0.rc2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: arel
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '6.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '6.0'
55
55
  description: Databases on Rails. Build a persistent domain model by mapping database
@@ -285,23 +285,23 @@ licenses:
285
285
  metadata: {}
286
286
  post_install_message:
287
287
  rdoc_options:
288
- - "--main"
288
+ - --main
289
289
  - README.rdoc
290
290
  require_paths:
291
291
  - lib
292
292
  required_ruby_version: !ruby/object:Gem::Requirement
293
293
  requirements:
294
- - - ">="
294
+ - - '>='
295
295
  - !ruby/object:Gem::Version
296
296
  version: 1.9.3
297
297
  required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  requirements:
299
- - - ">"
299
+ - - '>'
300
300
  - !ruby/object:Gem::Version
301
301
  version: 1.3.1
302
302
  requirements: []
303
303
  rubyforge_project:
304
- rubygems_version: 2.2.2
304
+ rubygems_version: 2.2.1
305
305
  signing_key:
306
306
  specification_version: 4
307
307
  summary: Object-relational mapper framework (part of Rails).