active_record_sql_exporter 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e70b14df77a12cb67e6e915615d03c8f2a7d173
4
- data.tar.gz: 30892f05a3e5779564839168ce6782d5dfbcdc37
3
+ metadata.gz: 424be3069f5c4eba7de91c11e9ecf4d5d1c992df
4
+ data.tar.gz: ffe6c1b80be0cff1f5771b9b10d3e22864e9b486
5
5
  SHA512:
6
- metadata.gz: 8f35eda59d3e19da78c3af14d873b9ebad17a88af20bc057af23a412d964d13e7f4909279941df36b49dd998c878ca6262da0ffc61a1b812de392b004efcdde2
7
- data.tar.gz: f8d653295436b0063a3dbc165030583674bcea62b348d5a21a7fcafe115c66e6e479387d0aa20836011c55d4debc893903440fa155bb13fc1bc37182a8a07580
6
+ metadata.gz: 0177db7db64008aae9161e45244c72cd309185f9900aa3776f5553717d8066e5a7fe6f8a6a1a24bbbf1ab51b1d4affa07512d1ad49af7fa9a797326c8c45c39d
7
+ data.tar.gz: 47cd991e77c821c7b86d1e9a8a7265976fba0870ab2e9a590eccfa24cf2a8c19ae2d801b0052c65912899b60d0a4ba6513fef1e6b0aae4897d1a476fbe6e6aa0
@@ -90,11 +90,16 @@ module ActiveRecord::SqlExporter
90
90
  def update_sql_string( key_name )
91
91
  data = []
92
92
  self.class.columns.map do |x|
93
- next if x.primary
93
+ next if is_primary_key_field?(x)
94
94
  data << "#{self.class.connection.quote_column_name( x.name )}=#{self.class.connection.quote( read_attribute(x.name))}"
95
95
  end
96
96
  "UPDATE #{self.class.quoted_table_name} SET #{data.join(',')} WHERE #{self.class.connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)};\n"
97
97
  end
98
+
99
+ def is_primary_key_field?(col)
100
+ (col.respond_to?(:primary) && col.primary) || (col.name == self.class.primary_key)
101
+ end
102
+
98
103
  # ------------------------------------------------------- sql_restore_string
99
104
  def sql_restore_string( args = {} )
100
105
  columns = self.class.columns.map do |x|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_sql_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Palmblad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-13 00:00:00.000000000 Z
11
+ date: 2017-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: 1.3.6
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.5.1
59
+ rubygems_version: 2.6.14
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: Export active record objects to raw sql.