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 +4 -4
- data/lib/active_record/sql_exporter.rb +6 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 424be3069f5c4eba7de91c11e9ecf4d5d1c992df
|
4
|
+
data.tar.gz: ffe6c1b80be0cff1f5771b9b10d3e22864e9b486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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:
|
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.
|
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.
|