composite_primary_keys 7.0.0 → 7.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b533cad3bf71d1945db74c8626cac9731a5a6d35
4
- data.tar.gz: c117bd2a65a362c69d36f0b2fe4e2495a9811933
3
+ metadata.gz: 67949f62c5795509a482f74ac109193f0d6e294a
4
+ data.tar.gz: 1705dca290c512bd57401db0d61cc58e2c13d6d1
5
5
  SHA512:
6
- metadata.gz: a08e6c2dafa9d5570a22ccc4cd12d4b9c598f3b8b463e1719d398408e76a3d05bf15278c620f3dad04939e63964f493f99c5efafa28d6cfab52bc4a06d15a50b
7
- data.tar.gz: 114d12d9f174d079a6172ac33748c25110c12f4400274f283f677eab664e2d77a868864b643080e1976fcc8c56e67e08b5fea9807b6eaa71f01d60f02339f549
6
+ metadata.gz: ebead783540875cd89cfefce57b3113b85d76295753d4029f54c5b866598a6a5961d1f0bb247fff7279716b1e9989bea4607c1be247e884b662ec934adcd08ef
7
+ data.tar.gz: 563cf8163a7526483b14018b4438134c7ca4cbac0b1868003d864d7f55348f61e686c472afed787db5ef8aed0377ee886a09d7167caf3a8623025ef21b106532
@@ -1,7 +1,21 @@
1
+ == 7.0.1 (2014-05-27)
2
+
3
+ * Fix setting of timestamps automatically by Rails (Charlie Savage)
4
+
1
5
  == 7.0.0 (2014-05-26)
2
6
 
3
7
  * Active Record 4.1 support! (Charlie Savage, Tom Hughes, Simon South)
4
8
 
9
+ Note there is one big api change. Previously, CPK supported both of these calls:
10
+
11
+ Membership.find(1,1)
12
+ Membership.find([1,1])
13
+
14
+ The first one no longer works. It was removed because it made the internal code simpler
15
+ and makes the intention of the code clearer (especially when finding multiple records).
16
+ If this change causes too much pain then please submit a ticket on Github.
17
+
18
+
5
19
  == 6.0.6 (2014-05-26)
6
20
 
7
21
  * Don't refer to deprecated set_primary_keys in README (Henare Degan)
@@ -88,9 +88,7 @@ See test/README_tests.rdoc
88
88
 
89
89
  == Questions, Discussion and Contributions
90
90
 
91
- The CPK home page is hosted at https://github.com/composite-primary-keys/composite_primary_keys. There
92
- is also a Google group at https://groups.google.com/forum/#!forum/compositekeys,
93
- but you'll have better luck getting support using GitHub.
91
+ For help please visit https://github.com/composite-primary-keys/composite_primary_keys.
94
92
 
95
93
  == Author
96
94
 
@@ -68,11 +68,9 @@ require 'active_record/relation/query_methods'
68
68
 
69
69
  require 'active_record/validations/uniqueness'
70
70
 
71
-
72
71
  # CPK files
73
72
  require 'composite_primary_keys/active_model/dirty'
74
73
  require 'composite_primary_keys/persistence'
75
- require 'composite_primary_keys/active_record_overides'
76
74
  require 'composite_primary_keys/base'
77
75
  require 'composite_primary_keys/core'
78
76
  require 'composite_primary_keys/composite_arrays'
@@ -34,7 +34,6 @@ module ActiveRecord
34
34
  class_eval <<-EOV
35
35
  extend CompositeClassMethods
36
36
  include CompositeInstanceMethods
37
- include CompositePrimaryKeys::ActiveRecord::Overides
38
37
  EOV
39
38
  end
40
39
  alias_method_chain :primary_key=, :composite_key_support
@@ -53,16 +53,6 @@ module CompositePrimaryKeys
53
53
  true
54
54
  end
55
55
  end
56
-
57
- def create_record(attribute_names = @attributes.keys)
58
- attributes_values = arel_attributes_with_values_for_create(attribute_names)
59
-
60
- new_id = self.class.unscoped.insert attributes_values
61
- self.id ||= new_id if self.class.primary_key
62
-
63
- @new_record = false
64
- id
65
- end
66
56
  end
67
57
  end
68
58
  end
@@ -2,7 +2,7 @@ module CompositePrimaryKeys
2
2
  module VERSION
3
3
  MAJOR = 7
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: composite_primary_keys
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Savage
@@ -38,7 +38,6 @@ files:
38
38
  - install.rb
39
39
  - lib/composite_primary_keys.rb
40
40
  - lib/composite_primary_keys/active_model/dirty.rb
41
- - lib/composite_primary_keys/active_record_overides.rb
42
41
  - lib/composite_primary_keys/associations/association.rb
43
42
  - lib/composite_primary_keys/associations/association_scope.rb
44
43
  - lib/composite_primary_keys/associations/has_and_belongs_to_many_association.rb
@@ -1,42 +0,0 @@
1
- module CompositePrimaryKeys
2
- module ActiveRecord
3
- module Overides
4
-
5
- # This override ensures that pkeys are set on the instance when records are created.
6
- # However, while ActiveRecord::Persistence defines a create_record method
7
- # the call in create_or_update is actually calling the method create_record in the Dirty concern
8
- # which removes the pkey attrs and also sets updated/created at timestamps
9
- # For some reason when we overide here we lose dirty!
10
- # So, for now, timestamps are recorded explicitly
11
- def create_record(attribute_names = nil)
12
- run_callbacks(:create) do
13
- record_timestamps!
14
- attribute_names ||= keys_for_partial_write
15
- attributes_values = arel_attributes_with_values_for_create(attribute_names)
16
-
17
- new_id = self.class.unscoped.insert attributes_values
18
-
19
- # DB like MySQL doesn't return the newly inserted result.
20
- # self.id cannot be updated for this case.
21
- self.id = new_id if self.class.primary_key and new_id.kind_of?(Array)
22
-
23
- @new_record = false
24
- id
25
- end
26
- end
27
-
28
- def record_timestamps!
29
- if self.record_timestamps
30
- current_time = current_time_from_proper_timezone
31
-
32
- all_timestamp_attributes.each do |column|
33
- if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil?
34
- write_attribute(column.to_s, current_time)
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
42
-