makumba_import 0.4.1 → 0.5

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: 19a4812592e85362942229cafc625559e1c26bbb
4
- data.tar.gz: 8e89cff73d4181458dc6344874f61f9a78643149
3
+ metadata.gz: d44f2f77a3193076a178162183d81328683a829d
4
+ data.tar.gz: 63f81ea80429f10b77696dcaa2f93e3eea54e911
5
5
  SHA512:
6
- metadata.gz: 858bdd9f0a38c40983ae9e151812f14c5acbb52cdb31c7450b969c58c5738e6650620422cbf74d025ec6ae352ef3fae97601ee9d06d29e9710d6c5f309e30aaf
7
- data.tar.gz: 8b8ab274f6f889e78a196ec8d7022a276e1abc7954fdd4adb7eb021105bcbaafbe028be84a8eeb169b11024ab800d1032f373413fd82be920555e7f314c94501
6
+ metadata.gz: 8bd20e5fe90af0261ae07d1c99fe1581f971496b91bc3397ca9af65a47d5b4e7bc62d362afd3ddbe06ba9ed9102b927a9fd5802548e6bdc4bbe1c1f090bde1cd
7
+ data.tar.gz: 8dbc2b67d84326a3f84a3e678dc29298e5b8fb6b2136657a994bf042e7ec7fea4827cdefa31091723a49ce2fc94c5ac82cf0d7d86cda4522a67f39125d92daae
@@ -17,7 +17,7 @@ module MakumbaImport
17
17
  end
18
18
 
19
19
  def self.next_primary_key(model)
20
- @redis.incr "maxprimary_#{model}_#{@dbsv}"
20
+ @redis.incr "maxprimary_#{model.table_name}_#{@dbsv}"
21
21
  end
22
22
 
23
23
  def self.update_redis_keys
@@ -28,16 +28,17 @@ module MakumbaImport
28
28
  end
29
29
  end
30
30
 
31
- models = ActiveRecord::Base.subclasses.collect { |type| type.name }.sort
31
+ models = ActiveRecord::Base.subclasses.select{|m| m.descends_from_active_record?}.collect { |type| type.name }.sort
32
32
 
33
33
  models.each do |model|
34
34
  begin
35
35
  object = Object.const_get(model)
36
36
  primary_key = object.primary_key
37
37
  current_max = object.unscoped.maximum(primary_key, :conditions => ["#{primary_key} > ? and #{primary_key} < ?", @dbsv << 24, (@dbsv + 1) << 24]) || ((@dbsv << 24) + 1)
38
- redis_key = "maxprimary_#{model}_#{@dbsv}"
38
+ redis_key = "maxprimary_#{model.table_name}_#{@dbsv}"
39
39
 
40
40
  @redis.set redis_key, current_max
41
+ puts "updated #{model} - #{model.table_name}"
41
42
  rescue => e
42
43
  puts "#{model} - #{e}"
43
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makumba_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marius Andra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-13 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Generate models matching your Makumba MDDs
14
14
  email: marius.andra@gmail.com
@@ -41,9 +41,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
41
  version: '0'
42
42
  requirements: []
43
43
  rubyforge_project:
44
- rubygems_version: 2.0.3
44
+ rubygems_version: 2.1.11
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: Makumba database integration with Rails applications
48
48
  test_files: []
49
- has_rdoc: