active_record_sql_exporter 0.2.1 → 0.2.2

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: f8a91667b02d05fe74928e8b08f3f0476d8a50b2
4
- data.tar.gz: ab3f30646e119aa9eb26881540ac07c69d535c57
3
+ metadata.gz: 19c82264aab67335e7ce06ad89afe81325f1eac9
4
+ data.tar.gz: 3888bb611c0bacd5f4860a5070da3512ca02e515
5
5
  SHA512:
6
- metadata.gz: 00ad019c975b1c890780f0e86b99b77d8f3b02b28e3f4ac2e7cf5b2cbe900f5aa26463a7f7445c80aa19fd7664dcaff430f35e8d5aaa709236251b831fb1f54a
7
- data.tar.gz: e533862a124d3e6fa10ce57a3658aafad4f560a1ad289673b0fc0870e2f808d82e24d40d66340daff7de3023182fabb9bf2d57cae8f3ed3cdc6e98c4a0ff5651
6
+ metadata.gz: 641cad95858480aede61bfefbef35773383b037b04b2eaff1c8004239a43235b29cc76e417a710cb5986a91e055a4a335a4888e965150d47f7d689daa1eb20ce
7
+ data.tar.gz: 7fcc713263c76b4da732a7650b57034a4a02aa923e866d497f5eeb57804cd77fd4634203b2e65e6117f0b019796e191ce01c20bc4ab7a859d047c0c97c286b85
@@ -36,7 +36,7 @@ module ActiveRecord::SqlExporter
36
36
  module ClassMethods
37
37
  # ---------------------------------------------------------- build_check_sql
38
38
  def build_check_sql( id )
39
- "IF( NOT EXISTS( SELECT * FROM #{quoted_table_name} WHERE #{connection.quote_column_name(primary_key)} = #{quote_value(id)} ) THEN ROLLBACK; END IF;\n"
39
+ "IF( NOT EXISTS( SELECT * FROM #{quoted_table_name} WHERE #{self.class.connection.quote_column_name(primary_key)} = #{quote_value(id)} ) THEN ROLLBACK; END IF;\n"
40
40
  end
41
41
  end
42
42
 
@@ -87,17 +87,17 @@ module ActiveRecord::SqlExporter
87
87
  data = []
88
88
  self.class.columns.map do |x|
89
89
  next if x.primary
90
- data << "#{connection.quote_column_name( x.name )}=#{connection.quote( read_attribute(x.name))}"
90
+ data << "#{self.class.connection.quote_column_name( x.name )}=#{self.class.connection.quote( read_attribute(x.name))}"
91
91
  end
92
- "UPDATE #{self.class.quoted_table_name} SET #{data.join(',')} WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)};\n"
92
+ "UPDATE #{self.class.quoted_table_name} SET #{data.join(',')} WHERE #{self.class.connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)};\n"
93
93
  end
94
94
  # ------------------------------------------------------- sql_restore_string
95
95
  def sql_restore_string( args = {} )
96
96
  columns = self.class.columns.map do |x|
97
- connection.quote_column_name( x.name )
97
+ self.class.connection.quote_column_name( x.name )
98
98
  end
99
99
  values = self.class.columns.map do |x|
100
- connection.quote( read_attribute( x.name ) )
100
+ self.class.connection.quote( read_attribute( x.name ) )
101
101
  end
102
102
 
103
103
  sql = "\nINSERT INTO #{self.class.quoted_table_name} (#{columns.join(',')}) VALUES (#{values.join(',')})"
@@ -132,7 +132,7 @@ module ActiveRecord::SqlExporter
132
132
  end
133
133
  # ---------------------------------------------------------- build_check_sql
134
134
  def build_check_sql
135
- "IF( NOT EXISTS( SELECT * FROM #{self.class.quoted_table_name} WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)} ) THEN ROLLBACK; END IF;\n"
135
+ "IF( NOT EXISTS( SELECT * FROM #{self.class.quoted_table_name} WHERE #{self.class.connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)} ) THEN ROLLBACK; END IF;\n"
136
136
  end
137
137
  # ---------------------------------------- convert_has_many_relations_to_sql
138
138
  def expand_tree_with_relations( tree, reflections, classes_to_ignore )
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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Palmblad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -27,7 +27,7 @@ dependencies:
27
27
  description: Quickly export an active record object to raw sql, useful for restoring
28
28
  partial data from a backup
29
29
  email:
30
- - Adam Palmblad
30
+ - apalmblad@gmail.com
31
31
  executables: []
32
32
  extensions: []
33
33
  extra_rdoc_files: []